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().
Move all Exceptions under GeosExceptions.hpp

… 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 115 to 116
/// The signal received and formatted
std::string m_signal;
Copy link
Contributor

Choose a reason for hiding this comment

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

That little guy seems to never be initialized (addSignalToMsg()?)
Maybe you can just remove it and read the Attribute::Signal entry

* @param errMsg Class containing all the error/warning information
* @param oss The output stream to write the content to.
*/
void ErrorLogger::writeToAscii( ErrorLogger::ErrorMsg const & errMsg, std::ostream & oss )
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe move that just over writeToYaml?

Comment on lines 82 to 83
/// String containing the target object name followed by the the file and line declaring it.
string m_dataDisplayString;
Copy link
Contributor

Choose a reason for hiding this comment

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

As the auto-constructor is extensively used in your PR, I would suggest moving m_dataDisplayString at top of m_attributes for clarity and to force to give this parameters.

Comment on lines 57 to 58
oss << "***** LOCATION: " << errMsg.m_file<< " l." << errMsg.m_line << "\n";
oss << "***** " << errMsg.m_cause << "\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

Be careful, it seems like ErrorMsg can be constructed without those. You can output them conditionnally or remove the empty ErrorMsg constructor (there are also solutions between the two).

Comment on lines 242 to 248
/**
* @brief Format all information in ErrorMsg and write it to the specified output stream
* @param errMsg The struct containing the error/warning object
* @param oss The output stream
*/
static void writeToAscii( ErrorLogger::ErrorMsg const & errMsg, std::ostream & oss );

Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark, can you move it with the associated functions?
Maybe I see why you ordered it that way, yes it is static, but it is a function, so you can place it wherever you want.
If you prefer it as it is, don't hesitate to tell.

}
catch( std::exception const & e )
{ // native exceptions management
ErrorLogger::ErrorMsg & errMsg = ErrorLogger::global().currentErrorMsg();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it lacks a lot of information here: at this point, IIRC, GEOS_THOW() has never been called, so the same information must be provided to the error message.

Appart from that, this part is a lot better!

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