Skip to content

Conversation

@arng40
Copy link
Contributor

@arng40 arng40 commented Nov 5, 2025

Remove code duplication found in GEOS_THROW, GEOS_ERROR, GEOS_WARNING and put into a static function in ErrorLogger.
Called while flushErrorMsg()

… link between GEOS_THROW_CTX_IF and LVARRAY_THROW_IF_TEST( EXP, MSG, TYPE )
… in try/catch statements

Problem: Retrieves everything that was thrown, so not just the message.
…y spaces.

The previous condition checked whether an argument was present and whether the option was immediately followed by a value like -test"value", which excluded valid cases like -test "value" et -test     "value".
Comment on lines 244 to 245
ErrorLogger::formatMsgToAscii( GEOS_GLOBAL_LOGGER.currentErrorMsg(), \
__asciiErrormSG ); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really useful to output the message here to the log?
The ErrorMsg get more and more info along the catch potencial cascade, then at the main() catch, it get fully flushed to the YAML. Why not doing the same for the log?

msgStruct.setCause( __causemsgsoss.str() ); \
msgStruct.addCallStackInfo( LvArray::system::stackTrace( true ) ); \
msgStruct.addContextInfo( GEOS_DETAIL_REST_ARGS( __VA_ARGS__ ) ); \
ErrorLogger::formatMsgToAscii( msgStruct, GEOS_GLOBAL_LOGGER.getErrorStream() ); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like formatMsgToAscii() should be done internally by flushErrorMsg().
Is it passing the unit test on your side?
Do you have a error/throw/warning test series? (I think you should have like at least 5 tests to validate, but unit tests should do that)

};

/**
* @brief Retrieve all informations from the ErrorLogger and format into a stream
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @brief Retrieve all informations from the ErrorLogger and format into a stream
* @brief Retrieve all informations from the ErrorMsg and format into a stream.

And IF it is needed to be public, you can add:

   *        Useful for formating a message log text externally.

else
{
GEOS_LOG_RANK( GEOS_FMT( "Unable to open error file for writing.\n- Error file: {}\n- Error file enabled = {}.\n",
m_filename, g_errorLogger.isOutputFileEnabled() ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Comment on lines 213 to 218
__FILE__, line1 ),
"- frame0: ",
"- frame1: ",
"- frame2: "
} );
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Syntax error.

Comment on lines 78 to 80
ErrorLogger::global().getErrorStream() << e.what();
ErrorLogger::global().flushErrorMsg( ErrorLogger::global().currentErrorMsg() );
LvArray::system::callErrorHandler();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the right direction (this is related with my other comments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI type: cleanup / refactor Non-functional change (NFC)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants