pulsar-edit / package-backend

Pulsar Server Backend for Packages
https://api.pulsar-edit.dev
MIT License
12 stars 11 forks source link

Improved returned Error Messages to Users #113

Closed confused-Techie closed 1 year ago

confused-Techie commented 1 year ago

Requirements

Description of the Change

This PR begins the process of improving the error messages returned to users when something on the backend fails.

It's a grip of mine personally when something goes wrong and all you get is Server Error with no details on what can be done to fix it.

This PR aims to begin solving this problem. Since previously all returned error messages have always matched what was originally returned by the Atom API server, we are now taking the chance to improve on those. Since from Pulsar to PPM to the frontend website there don't seem to be any special checks for the exact string of error messages, so this move seems safe to consider. Even then, in case there are third party tools that check the exact strings returned, those will still work without issue.

How this is done, is by not only returning the message that most users are familiar with, the backend will also return details (where supported) to provide deeper insight into what has gone wrong during the request. This new handling has first been added explicitly to the postPackagesVersion() function that handles the logic when a new package version is being published. As this seems to be the biggest current focus, it can help Pulsar Developers more quickly find the offending code when we have exact strings to use, and can help users to aid during troubleshooting to see what has gone wrong.

The eventual goal will be to have all error messages returned this way once possible.