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

Small improvements to error handling #760

Merged
merged 8 commits into from
Feb 13, 2024
Merged

Small improvements to error handling #760

merged 8 commits into from
Feb 13, 2024

Conversation

cinxmo
Copy link
Contributor

@cinxmo cinxmo commented Feb 12, 2024

Handles a couple of cases:

  • when a file exceeds the limit (postDeployFile)
  • when a deploy errors (postDeploy)

@cinxmo cinxmo requested review from mythmon and mbostock February 12, 2024 17:57
@cinxmo cinxmo requested a review from Fil February 12, 2024 18:21
src/deploy.ts Outdated
Comment on lines 377 to 396
if (isHttpError(error) && error.statusCode === 404) {
if (isHttpError(error) && error.statusCode === HttpStatusCode.NOT_FOUND) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not convinced about this indirection for http status codes. It's as easy to look up (or remember) numbers, esp. given that the error is rephrased just below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Fil this change definitely doesn't need to be added. I just think it's easier to think about the status message --> the error message instead of status code --> status message --> error message

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer the minimal diff. But at least this helps to show that we're using unauthenticated in this code in lieu of UNAUTHORIZED, which doesn't have the same meaning (in the sense that you could be authenticated as user x but not authorized to do action z).

Copy link
Contributor

@Fil Fil left a comment

Choose a reason for hiding this comment

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

Tested by attempting to upload a huge file (1GB):

└ Error: File too large to deploy: docs/hugefile.mp4. Maximum file size is 50MB

so that's good 👍

But it's surprising to me that we did not detect the issue before that 1GB was (completely) sent over to the server. Maybe in a follow-up we could anticipate and show the error much earlier?

@cinxmo
Copy link
Contributor Author

cinxmo commented Feb 12, 2024

@Fil yep! we're working on adding a preflight check

@cinxmo cinxmo requested a review from Fil February 12, 2024 21:14
src/deploy.ts Outdated Show resolved Hide resolved
@cinxmo cinxmo requested a review from mythmon February 13, 2024 00:10
@cinxmo cinxmo merged commit 7092b89 into main Feb 13, 2024
2 checks passed
@cinxmo cinxmo deleted the cindy/error-handling branch February 13, 2024 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants