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

Refactor/try catch unknown #1162

Merged
merged 5 commits into from
Oct 26, 2021

Conversation

tomrule007
Copy link
Contributor

@tomrule007 tomrule007 commented Oct 25, 2021

What

Clean up some technical debt adding better types to try..catch errors and remove unnecessary captures that just rethrow.

Why

So we can update to TypeScript 4.4+ without adding more technical debt by just casting errors back to any.
*TS now types errors as unknown instead of the old default any

How

  • Cast errors to correct type if known (ie ValidationError from yup)
  • Removed try..catches that just rethrow the same error and didnt add any additional information to the error log
    *The Apollo Log Plugin already logs all resolver errors)
  • Left error logs that added a msg but rethrow the same error instead of creating a new one
  • Update tests to reject with an error on mock prisma rejects

@vercel
Copy link

vercel bot commented Oct 25, 2021

@tomrule007 is attempting to deploy a commit to a Personal Account owned by @garageScript on Vercel.

@garageScript first needs to authorize it.

@vercel
Copy link

vercel bot commented Oct 25, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/c0d3/c0d3-app/7azBQwd2VuVTVFHSz8rR4GAK13Zh
✅ Preview: https://c0d3-app-git-fork-tomrule007-refactor-trycatch-unknown-c0d3.vercel.app

@codecov
Copy link

codecov bot commented Oct 25, 2021

Codecov Report

Merging #1162 (eda2552) into master (c2b4a75) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1162   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          144       144           
  Lines         2419      2397   -22     
  Branches       618       614    -4     
=========================================
- Hits          2419      2397   -22     
Impacted Files Coverage Δ
helpers/admin/adminHelpers.ts 100.00% <100.00%> (ø)
helpers/controllers/alertController.ts 100.00% <100.00%> (ø)
helpers/controllers/authController.ts 100.00% <100.00%> (ø)
helpers/controllers/challengesController.ts 100.00% <100.00%> (ø)
helpers/controllers/passwordController.ts 100.00% <100.00%> (ø)
helpers/controllers/starsController.ts 100.00% <100.00%> (ø)

@tomrule007 tomrule007 merged commit 4b140cb into garageScript:master Oct 26, 2021
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.

None yet

3 participants