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

Various API end points return no information at all about the error when an exception is thrown #459

Open
simon-20 opened this issue Mar 28, 2024 · 2 comments

Comments

@simon-20
Copy link
Contributor

Brief Description
In pub-get-stats-all/index.js, when an exception is thrown, the app returns a server 500 and attempts to convert the exception to a JSON object to send back to the client.

But this conversion process is broken, meaning that the client never receives any details about the error, just a 500 status with no further information.

The problem is that calling JSON.stringify(err) on an exception object err returns {}. The call needs to be JSON.stringify(err, Object.getOwnPropertyNames(err)).

@tillywoodfield
Copy link
Contributor

@simon-20, for a 500 error, would it be better to log the exception details, rather than return them to the user, as it exposes information about the internal workings of the app?

@simon-20
Copy link
Contributor Author

@simon-20, for a 500 error, would it be better to log the exception details, rather than return them to the user, as it exposes information about the internal workings of the app?

Hi Tilly, that's probably a good idea, even just for security reasons. It's likely to be IATI Devs who are using this info, though, so perhaps not something completely generic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants