cashmusic / platform

A free and open platform giving all musicians access to tools that let them manage, promote, and sell their music online.
https://cashmusic.org
Other
1.32k stars 266 forks source link

Implement error response messages on chosen Plant classes #1322

Open paperscissors opened 6 years ago

paperscissors commented 6 years ago

Doing a review of what I left hanging the last few times I made passes on the Platform code. One thing sticks out to me because it may actually help troubleshoot a thing or two on staging.

So historically the Platform kind of works as an API even when you're using requests locally. One of the biggest things that is a huge impediment in terms of development and troubleshooting is the lack of verbosity in errors.

There was no way originally to pass an actual error message and define the error code (404, 405, 500, etc), so at some point I setup a little method chaining facade that does that.

It would be a huge undertaking to put these verbose error messages everywhere out the gate, but I'm thinking: why not work them into places in the platform we're currently trying to troubleshoot on staging?

It's a pretty simple and non-glamorous thing out the gate; it's essentially changing spots in the Plant classes that return false with a more verbose sort of error, like

return $this->error('404')->message("No subscription plans found.");

I only really put together the functionality and cascade down to the API response, I haven't had time to really start putting these in place though.