Tech/LxEngine/Error Handling

From Athile

Jump to:navigation, search
Warning:    This page contains out-of-date information
 todo Integrate this page into the Internal Documentation page

Contents

Assertions

lx::core::assert( precondition, [const char* format, ...] )

Reserved for catching programmer preventable conditions. This obviously is not a strict definition, as it is not possible for all such conditions to be foreseen in advance, and may instead result instead from unforeseen runtime conditions. asserts are not compiled into production code.

With the rare exception of very high-performance inner-loop code, asserts should be accompanied with production code for issuing and error or warning along with the assert.

Examples

Suggestions

Fatal Errors

lx::core::fatal( const char* format, ...)

Reserved for non-recoverable errors where the application should save critical data, but otherwise shutdown as soon as possible. Will throw an lx::fatal_exception exception. During 'normal' operations, a fatal error should never occur.

An application should catch a lx::fatal_exception only to save any critical data then re-throw the exception to allow higher-level systems an opportunity to likewise save critical data.

Examples

Questions

Errors

lx::core::error( const char* format, ... )

Reserved for potentially recoverable error where the application should save critical data, but otherwise shutdown as soon as possible. Will throw an lx::error_exception exception.

An application may catch and consume an lx::error_exception, but should do so only with the error condition is fully understood to be correctable.

Examples

Warnings

lx::core::warn ( const char* format, ... )

Reserved for ignorable or locally recoverable conditions that indicate an inefficiency.


Examples

Log Messages

lx::core::log ( const char* subsystem, const char* format, ...)

Reserved for messages logged in production code noting significant events that will be useful in reproducing or analyzing the before of a customer application instantiation.

Examples

Debug Messages

lx::core::debug ( const char* channelId, const char* format, ...)

Reserved for debug-only messages that produce verbose output for in-development code. Due to the intentional verbosity, the debug messages are each associated with a channelId. Each channel is disabled by default, with the intention that a developer would enable only the channel or channels within which he or she is debugging or developing.

Examples

Suggestions

Navigation
Toolbox