-
Notifications
You must be signed in to change notification settings - Fork 11
feat: follow the same JSON:API structure for errors as the JS template #7
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
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.
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 |
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 |
Should we support detail, title and status? Should also be added to the mu-javascript-template (but that's a separate topic then). |
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.
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 |
🙌 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.
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.