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

Entry breaks if the blueprint does not exist #3920

Closed
jonassiewertsen opened this issue Jun 29, 2021 · 4 comments · Fixed by #3977
Closed

Entry breaks if the blueprint does not exist #3920

jonassiewertsen opened this issue Jun 29, 2021 · 4 comments · Fixed by #3977

Comments

@jonassiewertsen
Copy link
Contributor

If trying to open an entry with a non existing blueprint due to renaming etc, we do get a 500 Error in the cp.

Screenshot 2021-06-29 at 11 04 07

How to reproduce

  1. Create an entry
  2. Rename the blueprint inside the yaml file to something not existing.
  3. Open this entry in the cp

Expectations

I would hope for better error handling, in case we do open an entry with missing/wrong or outdated information.

What I would wish for (ordered after priority)

  1. A modal, saying that the blueprint does not exist with an option to select a new one.
  2. An error message in the show view somehow
  3. An Exception catching the error and informing, that it's due to a not existing Blueprint

One and two would be user friendly, making the cp bulletproof.

Environment

Statamic version: 3.1.24 Pro

PHP version: 8.0.6

@jonassiewertsen
Copy link
Contributor Author

This PR is great and will make the error much more clear. Thanks @duncanmcclean and @jasonvarga for the work!

Throwing an exception would still mean, that the control panel would break. (No doubt that the PR is helpful).

What would be necessary to offer a solution as mentioned in wishes 1 or 2?

  1. A modal, saying that the blueprint does not exist with an option to select a new one.
  2. An error message in the show view somehow

@duncanmcclean
Copy link
Member

Implementing 1 and 2 are significantly more work, as you've got to find all the entries/taxonomies etc using the blueprint and replace them.

Throwing an exception is the quickest way to fix it. It also helps with the case that someone makes a typo when manually setting a blueprint on an entry.

@jonassiewertsen
Copy link
Contributor Author

Important things first: Thanks for the PR and it's great that it has been merged. This is a nice improvement.

I am totally aware of the work, but do think that showing a 500 error is not a user-centric way of handling errors, if a plain user can trigger this kind of exception by using the cp (and he can).

@jasonvarga
Copy link
Member

How can a user trigger this error through the CP? You can't change blueprint handles in the CP. You can delete them, I suppose, but someone with permission to manage fields should probably know that deleting something is dangerous.

If you'd like to open a feature request in statamic/ideas for the extended solutions you mentioned, that's cool. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants