Allow CryptoExceptions to be fatal
This commit is contained in:
+3
-1
@@ -32,7 +32,9 @@ namespace Crypto {
|
||||
class CryptoException {
|
||||
public:
|
||||
string text;
|
||||
CryptoException( string s_text ) : text( s_text ) {};
|
||||
bool fatal;
|
||||
CryptoException( string s_text, bool s_fatal = false )
|
||||
: text( s_text ), fatal( s_fatal ) {};
|
||||
};
|
||||
|
||||
class Base64Key {
|
||||
|
||||
@@ -592,7 +592,11 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
|
||||
fprintf( stderr, "%s: %s\n", e.function.c_str(), strerror( e.the_errno ) );
|
||||
spin();
|
||||
} catch ( Crypto::CryptoException e ) {
|
||||
if ( e.fatal ) {
|
||||
throw;
|
||||
} else {
|
||||
fprintf( stderr, "Crypto exception: %s\n", e.text.c_str() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,10 +398,14 @@ void STMClient::main( void )
|
||||
req.tv_nsec = 200000000; /* 0.2 sec */
|
||||
nanosleep( &req, NULL );
|
||||
} catch ( Crypto::CryptoException e ) {
|
||||
if ( e.fatal ) {
|
||||
throw;
|
||||
} else {
|
||||
wchar_t tmp[ 128 ];
|
||||
swprintf( tmp, 128, L"Crypto exception: %s", e.text.c_str() );
|
||||
overlays.get_notification_engine().set_notification_string( wstring( tmp ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user