Repository navigation
Better err msg - #1201
Open
riclarsson wants to merge 2 commits into
Open
Better err msg#1201riclarsson wants to merge 2 commits into
riclarsson wants to merge 2 commits into
Conversation
Member
|
I like that the error macros are now plain functions. I don't like that the location of the error (filename, function, line number) is now only available in debug/relwithdebinfo builds. Knowing the exact place where the error occurred without having to re-run the whole setup in a debug/relwithdebinfo build to get that information was very helpful. Especially if you try to diagnose error reports from end-users. |
Contributor
Author
|
I agree it is useful. But the error messages looks more like C++ stacktraces than useful help to ensure people can fix what is wrong. That is not a good way to represent what is happening for python users. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI PR message:
Summary
Error messages are shorter and easier to read, and
ARTS_USER_ERROR/ARTS_USER_ERROR_IFare replaced by a plain function,arts::user_error.Most of the 215 changed files are the mechanical macro conversion. The substantive changes are in
debug.h/debug.cpp,mystring.h/mystring.cpp,workspace_method_class.cpp,gen_auto_py_methods.cpp,species_tags.ccand the files listed under "Message fixes".Error layout
ARTS_METHOD_ERROR_CATCHindents the error it passes on by two spaces, so nested functions give a readable trace instead of one flat block._/@prefixes, and the line explaining those prefixes is gone. Inputs and outputs were printed swapped; that is fixed.ARTS_METHOD_ERROR_CATCH. Debug and RelWithDebInfo builds still add file, function, line and column. TheFail check: <condition>line is gone in all builds.indent(text, indentation = " ")inmystring.h.mystring.h/mystring.cppmove from thestringslibrary toutil, sodebug.cppcan use it.Example, an IGRF time outside the valid range, Release build. Before:
After:
arts::user_errorreplaces the macros[[noreturn]], so it can end a function or aswitchdefault.ifaround the call. The arguments are only evaluated when the check fails, exactly as with the old macro; a passing check costs nothing beyond its condition, in every build type.constevalconstructor (std::source_locationas a default argument). No macros, standard C++23.std::formatitself accepts unused ones), and every argument must be formattable. A violation is a compile error at the call.ARTS_USER_ERROR, 1,570ARTS_USER_ERROR_IF.Message fixes
"text", x, "more", or a missing{}); found by the new compile-time check:atm_field.cpp,xml_io_old.cc(2),lbl_hitran.cpp,rtepack_transmission.cc,test_mdspan.cc(3).Other fixes
extract1Dread past the end of single-point grids (x.size() > 0should be> 1).Notes
doc/arts/dev.error.rstis rewritten forarts::user_error.🤖 Generated with Claude Code