> On 28 Feb 2018, at 17:46, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote: > > On Wed, Feb 28, 2018 at 04:43:15PM +0100, Christophe de Dinechin wrote: >> From: Christophe de Dinechin <dinechin@xxxxxxxxxx> >> >> 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). The point is that we get the *original* error, instead of some “bad_alloc” message thrown trying to format the error message. Even if I’m low on memory, I’d rather have: “unable to open file /foo/bar" instead of: “std::bad_alloc” _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel