Skip to content

Refactor errors#1331

Merged
svenstaro merged 3 commits intosvenstaro:masterfrom
cyqsimon:error-refactor
Jan 30, 2024
Merged

Refactor errors#1331
svenstaro merged 3 commits intosvenstaro:masterfrom
cyqsimon:error-refactor

Conversation

@cyqsimon
Copy link
Copy Markdown
Contributor

Motivation

I noticed that the ResponseError impl for ContexualError was not very complete. Many variants simply default to 500-ISE by wildcard match.

So I tried to fix that, but in the process I realised that some error variants are only encountered at program startup and not at runtime. Therefore I think it's much more appropriate to put them in separate enums.

Change summary

  • Split ContexualError into StartError & RuntimeError & AuthParseError
  • Made sure every RuntimeError variant has an accurate status code

- Split `ContexualError` into `StartError` & `RuntimeError`
- Made sure every `RuntimeError` variant has an accurate status code
@cyqsimon
Copy link
Copy Markdown
Contributor Author

Btw I intend to queue #1093 after this one.

@cyqsimon cyqsimon mentioned this pull request Jan 29, 2024
4 tasks
Copy link
Copy Markdown
Owner

@svenstaro svenstaro left a comment

Choose a reason for hiding this comment

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

I really like this! Maybe just rename the Start stuff to Startup and we should be good.

@svenstaro svenstaro merged commit 4058805 into svenstaro:master Jan 30, 2024
@svenstaro
Copy link
Copy Markdown
Owner

Very nice stuff!

@cyqsimon cyqsimon deleted the error-refactor branch January 30, 2024 02:27
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.

2 participants