Skip to content
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

Merged
merged 1 commit into from Jun 9, 2021

Conversation

jrhizor
Copy link
Contributor

@jrhizor jrhizor commented Jun 9, 2021

  • handles non-json case which doesn't have an error message
  • fixes build by including generated api docs

@jamakase fyi

@jrhizor jrhizor requested a review from jamakase June 9, 2021 23:16
@jrhizor
Copy link
Contributor Author

jrhizor commented Jun 9, 2021

Going to just merge this for now to fix the master build. Let me know if you want any changes for the error handling.

@jrhizor jrhizor merged commit 36488ef into master Jun 9, 2021
@jrhizor jrhizor deleted the jrhizor/fix-networkboundary-error branch June 9, 2021 23:17
@github-actions github-actions bot added area/documentation Improvements or additions to documentation area/frontend labels Jun 9, 2021
Copy link
Contributor

@jamakase jamakase left a 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");
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants