-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Stringify data on error reply #23
Conversation
@mlschuh, thanks for your contribution! Plz, tell, what kind of debugging tool do you use? Did you try the other tool? The thing is this field You could take a look at these libraries: PS: |
Going to issue another PR that does type checking on the result and only stringify the data if it's an object. |
@maxkoryukov Apologies, I didn't see your reply! I completely understand wanting using additional libraries for the debugging. My goal using this was to just dump a whole bunch of data into FreskDesk from our previous ticket system and thus wanted to eek by with as minimal code as possible. I'll follow your advice and use a library that's better at parsing those in the future. My own personal projects always pass around objects as well, I just never hit a problem with console.log before when doing basic debugging. Thanks for making me feel welcomed. Never did a PR in github before so it's good to see a nice community. |
@mlschuh , about this:
There is a great GH feature: if you have an opened PR, then ALL your commits to the source branch (in your case So, if you have opened a PR, and you want to modify something — you don't need to close/open new PR, just commit/push your changes to the existing PR |
@mlschuh And thank you for your contribution again;) I will be glad to merge your contributions, take a loot at these things:
I have added Also, you could omit changes in the |
@@ -34,7 +34,7 @@ function FreshdeskError(message, data, res) { | |||
this.message = message || 'Error in Freshdesk\'s client API' | |||
this.stack = (new Error()).stack | |||
|
|||
this.data = data | |||
this.data = JSON.stringify(data) |
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.
Probably, this will cause a lot of errors in other user's code.
When I was trying to debug a validation error, I was receiving the not terribly useful message:
I was able to resolve with a simple stringify on the data and now get something like this:
which is much more useful. I don't expect the testing would need to be updated for this to pass.