Setting errors in Loopback is done through 2 files: config.json and middleware.json.
Adding the stack (detailed error description) to Loopback works as follows:
The archive server/config.json:
- For type 500 errors only.
- Works only if the environment variable
NODE_ENV
is different from "Production", since for production the stack is removed (which makes perfect sense).
- To disable the stack in other environments, simply edit the property
errorHandler
:
"errorHandler": {
"disableStackTrace": true
}
The archive server/middleware.json for other types of errors:
- Deactivates/Activates in any environment, including the production environment since they are not deactivated automatically as with type 500 errors.
- To disable errors, simply add the following property:
"final:after": {
"loopback#errorHandler": {
"params": {
"includeStack": false
}
}
}
To separate the settings of each environment, just create the files with the name of the respective environment, for example, a project with 2 environments: Design and Production.
Just create the middleware.production.json
and config.production.json
when the environment variable NODE_ENV
is equal to production
, Loopback will automatically load the correct settings file.
Can you explain the question further? What
loopback
, the code that generated this error, a live example on https://c9.io/ or something that helps us understand your problem...– Sergio
@Sergio loopback is a framework to generate Rest API with nodejs. More information here: http://loopback.io/. The terms I used are all used in the framework, it may seem that the question is incomplete but it is not..
– Filipe Moraes
Okay, gave
+1
. If you have time soon I’ll take a look and see if I can help. In the meantime, if you have a minute: http://answall.com/edit-tag-wiki/3708– Sergio
@Sergio I will add more information about the tag as soon as I get home.
– Filipe Moraes
You managed to solve the problem?
– Sergio
@Sergio Yes, I will post an answer.
– Filipe Moraes