Error::Fmt( StrBuf * )

Format the text of an error into a StrBuf.

Virtual?

No

 

Class

Error

 

Arguments

StrBuf *buf

a pointer to the StrBuf to contain the formatted error

Returns

void

 

Notes

The result of Fmt() is suitable for displaying to an end user; this formatted text is what the command line client displays when an error occurs.

If an error has no severity (E_EMPTY), Fmt() returns with no change to the StrBuf.

If the error has severity of info (E_INFO), the StrBuf is formatted.

If the error has any higher severity, the StrBuf argument passed to Fmt() is cleared and then replaced with the formatted error.

Example

The following example code displays an error’s text:

if ( e.Test() )
{
    StrBuf msg;
    e.Fmt( &msg );
    printf( "ERROR:\n%s", msg.Text() );
}