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

Add custom exceptions #73

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Add custom exceptions #73

merged 4 commits into from
Dec 15, 2023

Conversation

nebfield
Copy link
Member

@nebfield nebfield commented Dec 14, 2023

This module defines a custom PGS exception hierarchy. There's a lot of exceptions for specific failure states,
which can be a bad approach and too complex. However, we did this anyway for a few reasons:

  1. There's only a few types of common errors (around a dozen, with 3-4 very common)
  2. Want to exit the program with custom exit codes to simplify communicating program
    state with external processes (e.g. PGS Catalog Calculator) without doing
    complicated things like logging to an external location
  3. This approach should make maintaining exit codes simple

So the plan is to override sys.excepthook, intercept errors defined here, and map them
to custom exit codes defined below

@nebfield nebfield marked this pull request as ready for review December 14, 2023 11:16
Copy link
Member

@smlmbrt smlmbrt left a comment

Choose a reason for hiding this comment

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

I don't see any problems with this, but it might make sense to organise the code to be:

Base Class
CatalogError
Specific catalog error
MatchError
Specific MatchError
...

@nebfield nebfield changed the base branch from stream_combine to dev December 14, 2023 16:18
@nebfield nebfield changed the base branch from dev to stream_combine December 14, 2023 16:19
@nebfield nebfield merged commit f2766d2 into stream_combine Dec 15, 2023
1 check passed
@nebfield nebfield deleted the exit_codes branch December 15, 2023 15:28
@nebfield nebfield mentioned this pull request Feb 15, 2024
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