Repository navigation
Better err msg - #1201
Better err msg#1201
Conversation
|
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. |
|
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. |
|
I agree we should avoid confusing users, but we also need to make sure we can |
|
I agree in this example that it works. Now imagine the method above is called in a parallel region.1 line of error information vs 4 lines of file/line information. Not just that, the error is caught and rethrown after the for loop, which will give a line number unrelated to the error itself. Also, the user cannot fix the error. In fact, the error is in the python code. I think that the C++ should just be conditional. Perhaps compile time conditional is too much and this should be controlled by a global? One that is always off in release but on in reldeb. |
|
The global seems to be a great solution to cover all the bases. Nice! |
|
@olemke Could you check what is wrong with windows conda? |
Must have been a temporary breakage in the miniconda chain. Started working again now without any change on our side. |
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