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

Convert console assertions into validation messages #25

Closed
mandolyte opened this issue Sep 10, 2020 · 1 comment
Closed

Convert console assertions into validation messages #25

mandolyte opened this issue Sep 10, 2020 · 1 comment

Comments

@mandolyte
Copy link
Contributor

mandolyte commented Sep 10, 2020

At present, at least for me, failed assertions cause the app to stop and go into the debugger. If the failures are already validation messages, then maybe convert them to ordinary log messages? Here are the two example I ran into today:

Assertion failed: lineNumber is repeated in location in {"priority":276,"message":"Missing OrigQuote field","bookID":"JUD","C":"1","V":"1","lineNumber":3,"location":" with ID 'ek3q' en JUD book package from unfoldingWord","extra":"TN"}
processNoticesCommon @ notice-processing-functions.js:131
processNoticesToSevereMediumLow @ notice-processing-functions.js:396

Assertion failed: lineNumber is repeated in location in {"priority":276,"message":"Missing OrigQuote field","bookID":"JUD","C":"1","V":"3","lineNumber":8,"location":" with ID 'yfa8' en JUD book package from unfoldingWord","extra":"TN"}
@RobH123
Copy link
Contributor

RobH123 commented Sep 22, 2020

@mandolyte Sorry that this caused problems for you. I usually only put assertions in the code where I want automatic notification of wrong programmer assumptions. The above example was a WIP wide refactoring where I had missed a few instances, so the asserts did exactly what I hoped for (and the failing code has now been fixed).

OTOH, I use logging for indicating program flow and also for simple debugging information.

So in summary, the asserts indicate programmer errors or wrong assumptions that do indeed require a fix.

@RobH123 RobH123 closed this as completed Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants