-
Notifications
You must be signed in to change notification settings - Fork 239
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
Replace std::abort() with std::runtime_error #1245
Conversation
Wouldn't it be better to introduce a macro |
#ifdef MSVC | ||
vsnprintf_s(buffer, size_of_buffer, _TRUNCATE, format_str.data(), args); | ||
#else | ||
vsnprintf(buffer, size_of_buffer, format_str, args ); |
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.
Error messages of more than 256 characters are pretty long, but I think there should be a check if the buffer was long enough, and if not a bigger buffer should be allocated dynamically (cf. "Notes" in http://en.cppreference.com/w/cpp/io/c/fprintf). ✅
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.
will check it
Will the error message of the exception always be printed? (I.e., in debug and release builds?) |
After the questions are answered 👍 |
|
At first I agreed with Christoph having a single macro like OGS_FATAL. This could be also replaced with something different than throw. On the other hand there are more exception types than the runtime error; having a single macro takes the opportunity to have different error handling... |
But catching exceptions occasionally is discouraged, AFAIK... |
how about a macro |
OGS_RUNTIME_ERROR is OK. |
no idea yet |
or shall we use |
updated. please check each commit |
perfect. 👍 |
OpenGeoSys development has been moved to GitLab. |
as issued in #1165. I added ERRMSG macro (see 74bd882) in StringTools.h so that one can write as
which generates an error message "Some error with type -1 at (file name), line (line no)".