[Spice-devel] [PATCH 12/22] Add exception handling classes

Christophe Fergeau cfergeau at redhat.com
Wed Feb 28 16:46:31 UTC 2018


On Wed, Feb 28, 2018 at 04:43:15PM +0100, Christophe de Dinechin wrote:
> From: Christophe de Dinechin <dinechin at redhat.com>
> 
> Throwing 'runtime_error' directly should be reserved for the support
> library.  Add an 'Error' class as a base class for all errors thrown
> by the streaming agent, as well as subclasses used to discriminate
> between categories of error.
> 
> The Error class offers:
> - a 'format_message' member function that formats a message without
>   allocating memory, so that there is no risk of throwing another
>   exception at throw time.

For what it's worth, if we get in an out of memory situation, the agent
is more than likely to be dying very soon anyway (and this is true for
most code out there in my opinion).

Chrisotp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180228/2b982b04/attachment.sig>


More information about the Spice-devel mailing list