-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix network boundary error / format #4011
Conversation
Going to just merge this for now to fix the master build. Let me know if you want any changes for the error handling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments. No need to make any work on them - I will make any additional changes that are required.
@@ -36,6 +36,7 @@ abstract class AirbyteRequestService { | |||
resultJsonResponse = await response.json(); | |||
} catch (e) { | |||
// non json result | |||
throw new CommonRequestError(response, "non-json response"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we do not need to throw error here. This section was ignored intentionally to follow the same flow for all errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't throw here then we get an NPE in throw new CommonRequestError(response, resultJsonResponse.message);
because resultJsonResponse
isn't defined.
@@ -27,7 +27,10 @@ class ApiErrorBoundary extends React.Component<unknown, BoundaryState> { | |||
return { errorId: ErrorId.VersionMismatch, message: error.message }; | |||
} | |||
|
|||
if (error.message === "Failed to fetch") { | |||
const isNetworkBoundaryMessage = error.message === "Failed to fetch"; | |||
const is502 = error.status === 502; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ErrorBoundary was assumed to keep level of errors processing as low as possible. I think we should probably add SeverUnavailableError
class and move processing to AirbyteRequestService
@jamakase fyi