-
Notifications
You must be signed in to change notification settings - Fork 11
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
Runtime: better errors #728
Conversation
// eg, if this came from our code, it doesn't help the user to see it but it does help us! | ||
// @ts-ignore | ||
this[util.inspect.custom] = (_depth, _options, _inspect) => { | ||
const str = `[${this.name}] ${this.message}`; |
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.
This turned out to be a major cause of information getting lost :(
TODO: a little worker testing locally, and running through a couple more cases in the issues. But I think this is about ready. EDIT: Glad I did this, caught a bug in logging for the worker. All fixed now, errors look great. Lets check CI then I think I can version up |
We've had ongoing problems getting errors out of the runtime, with too much information being obscured.
There's a few reasons for this - the biggest one being that I've designed error handling around Error objects, but errors aren't actually serializable, with mixed results.
This PR basically serializes an error before a) logging it and b) writing it to state.
This ensures that the error is visible in the logs and on the resulting object.
What is nice as that as well as having more content, the updated tests have, IMO, cleaner error objects.
#726 is tracking a better, more holistic fix in this area. But this gets us out of hot water for now relatively cheaply.
Issues
Closes #720 #612 OpenFn/adaptors#624
Screenshots
401s coming out of odk:
This is important because it shows the common http error object getting serialzied nicely (it also writes to state)
Reference errors