Skip to content
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

Log JSON payload if a JSON parsing error occured #52

Closed
LEQADA opened this issue Apr 23, 2019 · 0 comments · Fixed by #53
Closed

Log JSON payload if a JSON parsing error occured #52

LEQADA opened this issue Apr 23, 2019 · 0 comments · Fixed by #53
Labels
enhancement New feature or request notification Issue related to the notification module

Comments

@LEQADA
Copy link
Contributor

LEQADA commented Apr 23, 2019

Right now if this line fails
https://github.com/commercetools/commercetools-adyen-integration/blob/a6959d906ab6cc5050b872daefb6de40f88cb071/notification/src/api/notification/notification.controller.js#L17

we will log it like this:

err: {
 message:  "Unexpected number in JSON at position 652"    
 name:  "SyntaxError"    
 stack:  "SyntaxError: Unexpected number in JSON at position 652
  at JSON.parse (<anonymous>)
  at handleNotification (/app/src/api/notification/notification.controller.js:16:38)
  at process._tickCallback (internal/process/next_tick.js:68:7)"    
}

It's impossible to identify what was exactly wrong with the payload that it failed to parse.
We should catch the JSON parsing separately and in this case log the payload too.

@LEQADA LEQADA added enhancement New feature or request notification Issue related to the notification module labels Apr 23, 2019
LEQADA added a commit that referenced this issue Apr 23, 2019
…f-unexpected-error

#52 log the payload received from adyen in case of error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request notification Issue related to the notification module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant