question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Errors in hooks are swallowed

See original GitHub issue

Is there a reason hook errors aren’t exposed to the user? We go straight from try to finally:

https://github.com/lukeed/uvu/blob/e419ff993b03094d61c2a29a3c8874b1dea929e1/src/index.js#L88

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
jirutkacommented, Dec 26, 2020

@lukeed, this is a serious bug – when an error is thrown in e.g. before hook, it’s not even logged in the console, so the user has no idea what went wrong.

test.before(() => {
  throw Error('Oh crap!')
})

test('some test', () => {
  // ...
})

test.run()
index.test.ts
  (0 / 1)

  Total:     1
  Passed:    0
  Skipped:   0
  Duration:  0.85ms

I wanted to use uvu in one of my projects, but this is a dealbreaker for me. 😦

1reaction
lukeedcommented, Mar 25, 2021

Wrap your hook code in try/catch. Will be fixed soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors in hooks.js are silently swallowed #1170 - sveltejs/kit
Describe the bug Whenever there is any sort of issue with my src/hooks.js file it is silently swallowed and the hooks are no...
Read more >
What To Do When a Fish Swallows Your Hook - YouTube
What should you do when a fish swallows your hook ? According to most research papers, if you are unable to easy remove...
Read more >
Why shouldn't I use catch() to handle errors in React useEffect ...
Note: it's important to handle errors here instead of a catch() block so that we don't swallow exceptions from actual bugs in components....
Read more >
Swallow the Hook: Hubbard, S.W. - Amazon.com
The characters are great. The plot is good, but a little slow. Didn't find a lot of errors, if any, in the book....
Read more >
'It just happened so fast': Dog needed $3K surgery after ... - CBC
Sabrina Byrnes says her dog, Hannah, swallowed a hook with line still attached. The surgery to remove it cost $3,400. (Tina MacKenzie/CBC).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found