Error::Clear()

Remove any error messages from an Error object.

Virtual?

No

 

Class

Error

 

Arguments

None

 

Returns

void

 

Notes

Clear() can be used if you need to clear an Error after having handled it in a way that does not automatically clear it.

Example

The following code attempts to establish a connection to a nonexistent server, displays the error’s severity, clears the error, and shows that the error has been cleared:

ClientApi client;
Error e;

client.SetPort( "bogus:12345" );
client.Init( &e );

printf( "Error severity after Init() is is %d.\n", e.GetSeverity() );
e.Clear();
printf( "Error severity after Clear() is %d.\n", e.GetSeverity() );

Executing the preceding code produces the following output:

Error severity after Init() is 4.
Error severity after Clear() is 0.