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
better error handling for missing model error #8328
better error handling for missing model error #8328
Conversation
Signed-off-by: Thomas Chezieres <tchezieres@MacBook-Pro.lan>
7717bc4
to
5020233
Compare
Signed-off-by: Thomas Chezieres <tchezieres@MacBook-Pro.lan>
56dee67
to
8304869
Compare
Codecov Report
@@ Coverage Diff @@
## master #8328 +/- ##
==========================================
- Coverage 33.20% 33.19% -0.01%
==========================================
Files 1220 1220
Lines 13610 13612 +2
Branches 1355 1356 +1
==========================================
Hits 4519 4519
- Misses 8208 8209 +1
- Partials 883 884 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thank you for your contribution 💯
You're welcome, it's a pleasure to work with Strapi 😃 |
Description of what you did:
Actually, if a model is missing from the configuration but present in the database, you get the following error message:
[2020-10-14T09:17:43.597Z] debug ⛔️ Server wasn't able to start properly. [2020-10-14T09:17:43.599Z] error TypeError: Cannot read property 'attributes' of undefined at Object.getNature (/usr/app/node_modules/strapi-utils/lib/models.js:83:61) at Object.keys.forEach.name (/usr/app/node_modules/strapi-connector-bookshelf/lib/mount-models.js:127:21) at Array.forEach (<anonymous>) at Object.keys.map (/usr/app/node_modules/strapi-connector-bookshelf/lib/mount-models.js:120:40)
The problem is it doesn't let you know which model is causing the error.
I just added an error handling statement to show which model is blocking the server from starting.