-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Error & debug handling for developers #8222
Labels
server / core
Issues relating to the server or core of Ghost
Comments
4 tasks
kirrg001
added a commit
to TryGhost/gscan
that referenced
this issue
Jun 1, 2017
refs TryGhost/Ghost#8222 - we differentiate between errors and fatal errors - based on this property, Ghost can decide to activate a theme - no tests yet (coming soon)
kirrg001
added a commit
to kirrg001/gscan
that referenced
this issue
Jun 1, 2017
refs TryGhost/Ghost#8222 - revert the other two options
kirrg001
added a commit
to kirrg001/gscan
that referenced
this issue
Jun 1, 2017
refs TryGhost/Ghost#8222 - revert the other two options
kirrg001
added a commit
to kirrg001/gscan
that referenced
this issue
Jun 1, 2017
refs TryGhost/Ghost#8222 - revert the other two options
kirrg001
added a commit
to TryGhost/gscan
that referenced
this issue
Jun 1, 2017
refs TryGhost/Ghost#8222 - revert the other two options
kirrg001
added a commit
to kirrg001/Ghost
that referenced
this issue
Jun 4, 2017
refs TryGhost#8222 - differentiate between errors and fatal errors - use gscan errors in theme middleware - Adds a new `error()` method to `currentActiveTheme` constructor which will return the errors we receive from gscan - In middleware, if a theme couldn't be activated because it's invalid, we'll fetch the erros and send them to our error handler. We also use a new property `hideStack` to control, if the stack (in dev mode and if available) should be shown or the gscan errors (in prod mode, or in dev if no stack error) - In our error handler we use this conditional to send a new property `gscan` to our error theme - In `error.hbs` we'll iterate through possible `gscan` error objects and render them. - remove stack printing - stack for theme developers in development mode doesn't make sense - stack in production doesn't make sense - the stack is usually hard to read - if you are developer you can read the error stack on the server log - utils.packages: transform native error into Ghost error - use `onlyFatalErrors` for gscan format and differeniate fatal errors vo.2 - optimise bootstrap error handling - transform theme is missing into an error - add new translation key - show html tags for error.hbs template: rule
aileen
pushed a commit
that referenced
this issue
Jun 6, 2017
refs #8222 - differentiate between errors and fatal errors - use gscan errors in theme middleware - Adds a new `error()` method to `currentActiveTheme` constructor which will return the errors we receive from gscan - In middleware, if a theme couldn't be activated because it's invalid, we'll fetch the erros and send them to our error handler. We also use a new property `hideStack` to control, if the stack (in dev mode and if available) should be shown or the gscan errors (in prod mode, or in dev if no stack error) - In our error handler we use this conditional to send a new property `gscan` to our error theme - In `error.hbs` we'll iterate through possible `gscan` error objects and render them. - remove stack printing - stack for theme developers in development mode doesn't make sense - stack in production doesn't make sense - the stack is usually hard to read - if you are developer you can read the error stack on the server log - utils.packages: transform native error into Ghost error - use `onlyFatalErrors` for gscan format and differeniate fatal errors vo.2 - optimise bootstrap error handling - transform theme is missing into an error - add new translation key - show html tags for error.hbs template: rule
I'm still seeing some problems with theme error handling, whereby Ghost shows "the currently active theme X is missing" when the theme is fine and something else is wrong. Reproduction case A - gscan is broken:
Reproduction case B - invalid node version:
|
ErisDS
added a commit
to ErisDS/Ghost
that referenced
this issue
Oct 11, 2017
closes TryGhost#8222 - There are still some cases where Ghost shows "the currently active theme X is missing" when it isn't - This is due to the error handling masking several cases - This PR resolves that, ensuring errors from gscan and the underlying environment don't get masked
kirrg001
pushed a commit
that referenced
this issue
Oct 11, 2017
closes #8222 - There are still some cases where Ghost shows "the currently active theme X is missing" when it isn't - This is due to the error handling masking several cases - This PR resolves that, ensuring errors from gscan and the underlying environment don't get masked
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#Refs #7491
I've heavily reworked how themes are loaded, validated & how they work in general over the course of the last couple of weeks.
This has resulted in what is sort of a bug and sort of a concept that hasn't been worked through correctly.
Bug report:
Starting Ghost with an invalid theme results in a small log warning that says "The active theme is invalid". This is just a warning, because the admin panel will still load. This is the correct behaviour, although the warning should probably be bigger and clearer.
However, when you finally come to try to access a page of your blog, the error you get says:
"The currently active theme is missing".
It's missing because due to the theme being invalid, we didn't load it in. So now Ghost (somewhat correctly) thinks your active theme isn't present.
For those users who miss the invalid warning (which will be pretty much everyone) this will be the first message they see, and it's effectively wrong and very confusing.
Where it gets interesting
There are 2 cases for which an active theme can be invalid:
CASE 1: only affects developers / development mode. CASE 2: will impact all users and is effectively us doing something wrong (we should have known that this would happen and ensured the theme was updated first), but the impact is huge - the whole blog will refuse to render.
Note that the reason why the error message is wrong is because we don't activate the invalid theme. This means we don't keep reference to the gscan output or state of the theme, and so in the current iteration we cannot tell the user a better error. It's just missing.
Even worse, if you're a developer working on a theme, the most common error that will happen is malforming some handlebars, in which case you want handlebars to give you the compile errors when you try to render the page, not gscan to fail to boot. However, gscan will detect the error, the theme won't activate, and you'll be left with gscan errors, which we currently don't even output 😖
Potential solution
There are 3 mechanisms for activating a theme:
Both of these cases ONLY impact on the boot. This got me thinking we need to further evolve the concept of "mounting" and "activating".
If a theme is being actively activated by a user (via activate or upload endpoints), we should return the output from gscan and go no further.
On boot, we need a more evolved approach. I think the rules need to be something like this:
DEV MODE
PROD MODE
I'm not 100% sure, I first need to implement a way to pass through gscan errors and see what they can look like rendered.
The text was updated successfully, but these errors were encountered: