-
Notifications
You must be signed in to change notification settings - Fork 4
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
Use Axios's toJSON
method to make shorter errors
#632
Conversation
d6f5b48
to
a9a16d1
Compare
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.
Good goal! We decided what we'd like to do is properly isolate the .toJSON()
calls in the docassemble_api_REST.js
file. That way, everything else can just throw the error without worrying about it. Only the functions in the REST file will use .toJSON()
.
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.
I made some notes, but I don't think they're blockers (iirc). I think this is a great change in general.
Needs a CHANGELOG update 😬 |
On an example erroring docassemble server (for example, this server returning a [502 to a delete project](https://github.com/SuffolkLITLab/docassemble-EFSPIntegration/actions/runs/3641406524/jobs/6147303425)), the entire axios error will print, which is that case in 1.8k lines, most of it being garbage. Axios has a `toJSON()` method on errors that should reduce length of the errors being shown, as it will not print the most annoying parts of the long errors, like the internal Axios socket objects Still need to test, as it's difficult to get a server to 502 on demand. Fix #605.
But not too long.
Co-authored-by: plocket <52798256+plocket@users.noreply.github.com>
3dabf05
to
b46d2d6
Compare
Did a changelog update, should be ready to go! |
* Use Axios's `toJSON` method to make shorter errors On an example erroring docassemble server (for example, this server returning a [502 to a delete project](https://github.com/SuffolkLITLab/docassemble-EFSPIntegration/actions/runs/3641406524/jobs/6147303425)), the entire axios error will print, which is that case in 1.8k lines, most of it being garbage. Axios has a `toJSON()` method on errors that should reduce length of the errors being shown, as it will not print the most annoying parts of the long errors, like the internal Axios socket objects Still need to test, as it's difficult to get a server to 502 on demand. Fix #605. * Actually fail when we log the errors * Move `toJSON()` calls to docassemble_api_REST * Add better comment to `process.exitCode` Co-authored-by: plocket <52798256+plocket@users.noreply.github.com>
* Use Axios's `toJSON` method to make shorter errors On an example erroring docassemble server (for example, this server returning a [502 to a delete project](https://github.com/SuffolkLITLab/docassemble-EFSPIntegration/actions/runs/3641406524/jobs/6147303425)), the entire axios error will print, which is that case in 1.8k lines, most of it being garbage. Axios has a `toJSON()` method on errors that should reduce length of the errors being shown, as it will not print the most annoying parts of the long errors, like the internal Axios socket objects Still need to test, as it's difficult to get a server to 502 on demand. Fix #605. * Actually fail when we log the errors * Move `toJSON()` calls to docassemble_api_REST * Add better comment to `process.exitCode` Co-authored-by: plocket <52798256+plocket@users.noreply.github.com>
On an example erroring docassemble server (for example, this server returning a 502 to a delete project), the entire axios error will print, which is that case in 1.8k lines, most of it being garbage.
Axios has a
toJSON()
method on errors that should reduce length of the errors being shown, as it will not print the most annoying parts of the long errors, like the internal axios socket objectsThe errors look like this now, which IMO is an improvement:
Fix #605.