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

Implement type safe error handling #100

Merged
merged 7 commits into from
Jan 22, 2022
Merged

Implement type safe error handling #100

merged 7 commits into from
Jan 22, 2022

Conversation

7tint
Copy link
Member

@7tint 7tint commented Jan 22, 2022

Ticket link

Closes #99

Implementation description

  • Added a getErrorMessage utility function
  • Replace all errors with type unknown
  • Replaced current Logger messages to use getErrorMessage

Steps to test

  1. Make sure that application runs as expected and errors are being logged properly

What should reviewers focus on?

  • Didn't miss any errors to be replaced

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

@7tint 7tint requested review from sherryhli and LenaNguyen January 22, 2022 05:06
Copy link
Member

@sherryhli sherryhli left a comment

Choose a reason for hiding this comment

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

There are some cases where the error is being explicitly typed as any, do you mind addressing those too? They're flagged by the linter github actions workflow.

The rest looks good!

@7tint
Copy link
Member Author

7tint commented Jan 22, 2022

There are some cases where the error is being explicitly typed as any, do you mind addressing those too? They're flagged by the linter github actions workflow.

The rest looks good!

Just fixed this up. 🔨

Should we do anything about the firebaseError and postgresError error types? They are currently marked as type any.

@7tint 7tint requested a review from sherryhli January 22, 2022 19:27
@sherryhli
Copy link
Member

Should we do anything about the firebaseError and postgresError error types? They are currently marked as type any.

@lambo-liu Yes, let's type them as unknown as well

@7tint
Copy link
Member Author

7tint commented Jan 22, 2022

Should we do anything about the firebaseError and postgresError error types? They are currently marked as type any.

@lambo-liu Yes, let's type them as unknown as well

@sherryhli Should be good now! Let me know if there is anything else we need to patch up 🪡

Copy link
Member

@sherryhli sherryhli left a comment

Choose a reason for hiding this comment

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

:shipit:

@7tint 7tint merged commit e5de3e9 into main Jan 22, 2022
@7tint 7tint deleted the type-safe-error-handling branch January 22, 2022 23:07
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.

Type-safe error handling in backend
2 participants