Uh oh!
There was an error while loading. Please reload this page.
feat: follow the same JSON:API structure for errors as the JS template - #7
Conversation
In the [JS template](https://github.com/mu-semtech/mu-javascript-template/blob/master/helpers/mu/server.js#L30-L35) errors get a message passed in which is returned as the title member. Note that the JS template should also pass status as a member of the error obejct, as happens here, but it currently doesn't.
MikiDi
commented
Mar 24, 2023
For consistency with JS template I agree, but on looking closer I remember why doing it this way: the spec states that either one is ok (as a minimum), but that |
sergiofenoll
commented
Mar 24, 2023
I interpreted that as Either way one way or another we're always going to be passing these as parameters, right? I think here's it's just a case of developers needing to be consistent. I don't see much of a point in having a |
madnificent
commented
Oct 3, 2023
Should we support detail, title and status? Should also be added to the mu-javascript-template (but that's a separate topic then). |
sergiofenoll
commented
Oct 4, 2023
Passing in Personally, I'd at the very least add all three field you mention, a "generic" |
It seems to make sense to describe the specific model that may be followed because we had to look it up ourselves. Updating the implementation to that.
madnificent
commented
Oct 4, 2023
I got bitten by too small of a context when looking at the change. This was correct indeed. I've added the currently allowed keys explicitly. I had to look up the available options and I expect others will need to do same. Not sure if we should still accept |
sergiofenoll
commented
Oct 4, 2023
🙌 Thanks for the changes! Maybe leave in Though if I had to guess, the python template probably doesn't see nearly as much use as the other ones, so this might never have been called with kwargs yet. |
The error helper now has deprecated support for **kwargs. Any argument that does not belong to the runtime will be warned about.
madnificent
commented
Oct 5, 2023
Would now look like this in the console: If that looks good enough then we can pull in master and merge it. |
In the JS template errors get a message passed in which is returned as the title field of the JSON:API response object.
Note that the JS template should also pass status as a member of the error object, as happens here in the Python template, but it currently doesn't.