-
Notifications
You must be signed in to change notification settings - Fork 14
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
Catch unexpected exceptions and offer to report them as bugs #627
Conversation
🦋 Changeset detectedLatest commit: eb70190 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The preview packages of this pull request have been published. @bigtest/agentInstall using the following command: $ npm install @bigtest/agent@no-naked-errors Or update your package.json file: {
"@bigtest/agent": "no-naked-errors"
} bigtestInstall using the following command: $ npm install bigtest@no-naked-errors Or update your package.json file: {
"bigtest": "no-naked-errors"
} @bigtest/cliInstall using the following command: $ npm install @bigtest/cli@no-naked-errors Or update your package.json file: {
"@bigtest/cli": "no-naked-errors"
} @bigtest/clientInstall using the following command: $ npm install @bigtest/client@no-naked-errors Or update your package.json file: {
"@bigtest/client": "no-naked-errors"
} @bigtest/effection-expressInstall using the following command: $ npm install @bigtest/effection-express@no-naked-errors Or update your package.json file: {
"@bigtest/effection-express": "no-naked-errors"
} @bigtest/interactorInstall using the following command: $ npm install @bigtest/interactor@no-naked-errors Or update your package.json file: {
"@bigtest/interactor": "no-naked-errors"
} @bigtest/serverInstall using the following command: $ npm install @bigtest/server@no-naked-errors Or update your package.json file: {
"@bigtest/server": "no-naked-errors"
} @bigtest/webdriverInstall using the following command: $ npm install @bigtest/webdriver@no-naked-errors Or update your package.json file: {
"@bigtest/webdriver": "no-naked-errors"
} |
Very cool! Two small tweaks we could do:
|
ad76890
to
e09ed6b
Compare
@jnicklas done! Those are pretty cool techs. I did notice that including html comments inside the github link as I had it was breaking the |
e09ed6b
to
0af38c6
Compare
@cowboyd hmm, I tried this out, and the link didn't render for me, so I tried to figure out what's going on, and then realized that unfortunately terminal links are not supported in tmux, so tmux will just show this as plain, unlinked text :( They have an open PR for it, but it seems to be stalled. tmux/tmux#2403 |
What do you think w.r.t. testing? |
How about just unit testing this thing? That should be fine, right? One issue that occurred to me is what happens in case of a port collision? We should handle those somewhat gracefully, imo, and not throw a screaming error in case it happens, because it really isn't an innternal failure. |
I agree. We're totally able to handle that, even if it means that we log an error and exit. |
It's a tough look whenever something terrible happens and the server or the CLI halts without doing the thing that you were asking it to do. For example, we were having an issue with our proxy server crashing on canceled requests with: ``` Error: unexpected end of file at Zlib.zlibOnError [as onerror] (zlib.js:180:17) { errno: -5, code: 'Z_BUF_ERROR' } ``` It's even worse when that happens, and it silently makes a terrible impression on our users and we never even have the notification that it happened. This change catches all top-level exceptions that are _not_ effetion `MainError`s and prints out an explanation and generates a link to a new github issue with several diagnostic values pre-filled in.
6d3328a
to
c7213fe
Compare
c7213fe
to
eb70190
Compare
Oops, forgot to commit a file |
How about a fix for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with this for now and we can fix the port issue later.
Motivation
It's a tough look whenever something terrible happens and the server or the CLI halts without doing the thing that you were asking it to do. For example, we were having an issue with our proxy server crashing on canceled requests with:
It's even worse when that happens, and it silently makes a terrible impression on our users and we never even have the notification that it happened.
Approach
This change catches all top-level exceptions that are not effetion
MainError
s and prints out an explanation and generates a link to a new github issue with several diagnostic values pre-filled in.Screeshots
TODOS & Open Questions
warnUnexpectedErrors()
middleware directly, but It's kind of a small test given something that is so over-arching in its effect. If there were some way to booby-trap the CLI so that by running thebigtest throw
command, you could have it raise an arbitrary exception from the CLI. Ideally, we could use a plugin architecture inside the test case to exend the CLI with athrow
command, but that seems like a lot of work. Still, having our thing that is there to give us a good look even when we look bad, makes us look even worse.... well that is really bad. So not having this really well tested feel dangerousMainError
s, but that felt not so great. It occurred to me that what might even be better would be to have thePromise
returned from @effection/nodealways resolve on both successful exits _and_ on
MainError` exits since these are still expected outcomes. Only on an unexpected error would the promise actually reject. This would have the benefit of allowing custom error handling of unexpected exits, but baked in handling of all expected exits. In other words, we would have been able to write this as:This just makes the unexpected exit code a lot easier to write since it is just a function, not an operation, and it doesn't need to know anything amout
MainError