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/error-handling-status #577

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jszuminski
Copy link
Contributor

We need to throw an appropriate status, depending on whether the issue was caused by the user or by us (the server).

@PaulDalek you were working on the ExportError.js so you may know best which parts of code should be worth replacing or if you would like this statusCode passing to look a different way so feel free to push any commits if you'd like it to be solved another way.

@jszuminski jszuminski added the bug label Sep 18, 2024
@jszuminski jszuminski self-assigned this Sep 18, 2024
@PaulDalek
Copy link
Contributor

@jszuminski Looks good! Setting right status code for each of the ExportError(...) occurance should resolve the problem.

Copy link
Contributor

@PaulDalek PaulDalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@@ -72,7 +72,7 @@ const createImage = (page, type, encoding, clip, rasterizationTimeout) =>
}),
new Promise((_resolve, reject) =>
setTimeout(
() => reject(new ExportError('Rasterization timeout')),
() => reject(new ExportError('Rasterization timeout', 500)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this should return 500 - I think it should return a 408. It mostly happens when people are trying to export very large charts, so it shouldn't necessarily report back to the health checkers as "there's a problem with the service itself", as the server should be able to recover from it. 500's should be reserved for when the server is in an unrecoverable error state.

A 408 is regardless more applicable when dealing with timeouts in general.

Same for the one on L109.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants