cht-core
cht-core copied to clipboard
Add error object to sentinel start up error log (#8348)
fix(#8348): add error object to sentinel start-up error log
Description
When starting the sentinel project in development mode, the message Waiting for API to be ready ...
gets printed on the console if the module is not able to reach the dev-api project.
Adding the err
object as part of the logs will provide more insights on what could be the reason the app is not able to connect to the dev-api. To minimize the impact of the log size, and the repetition of the same error over and over, The error object will be logged at every tenth attempt of connection.
#8348
Code review checklist
- [ ] Readable: Concise, well named, follows the style guide, documented if necessary.
- [ ] Documented: Configuration and user documentation on cht-docs
- [ ] Tested: Unit and/or e2e where appropriate
- [ ] Internationalised: All user facing text
- [ ] Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.
@ElijahBus Have you had a chance to have another look at this?
Hi @garethbowen @dianabarsan !
Sorry for the late reply, I have given this another try; In response to the mentioned points :
The error will most likely be the same at this point with only one reason the "Sentinel service" cannot establish a connection with the API service, and since the error being thrown comes from the API service, Unless the implementation changes on the API Service, probably by returning a custom Error, then we might have a different error.
Another alternative could be to check the error code, and we only log the full trace twice if the previous error code isn't the same as the current one, what do you think about that, will it make the solution more complex and probably rise the idea of checking other error codes as well ( now or in the future ) ?
The full trace isn't so big though,
Here is what the error looks like: