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

Display Custom Error Messages On "model.save" Failure #1515

Open
mattoberle opened this issue Feb 16, 2021 · 0 comments
Open

Display Custom Error Messages On "model.save" Failure #1515

mattoberle opened this issue Feb 16, 2021 · 0 comments
Labels

Comments

@mattoberle
Copy link
Contributor

clay/amphora implements error handlers that return the following JSON when an exception is encountered (eg. during model.save):

{ "message": "The Error's Message Here", "code": 500 }

When Kiln encounters these errors it displays a generic Error publishing article in the "snack bar".

This happens here while saving a component:
https://github.com/clay/clay-kiln/blob/master/lib/component-data/actions.js#L52-L71

And happens here on page publish:
https://github.com/clay/clay-kiln/blob/master/lib/drawers/publish-page.vue#L305-L314

Kiln has the context to display a more detailed message via e.response:

let error = new Error(res.statusText);
error.response = res;


Rather than teaching editors to open their browser's developer tools to retrieve a console log, we should include additional information in the message itself.

This could be accomplished in two ways:

  1. Grab the response JSON and include the message attribute (low-effort, kiln-only change).
  2. Assign a uuid in clay/amphora's error handler, log it in Amphora, display it in Kiln.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant