Re: [PATCH v2 18/24] Catch all std::exception derivatives (including std::bad_alloc, not a std::bad_alloc)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2018-02-21 at 18:46 +0100, Christophe de Dinechin wrote:
> From: Christophe de Dinechin <dinechin@xxxxxxxxxx>
> 
> I also added a catch-all clause for double plus extra safety
> 
> Signed-off-by: Christophe de Dinechin <dinechin@xxxxxxxxxx>
> ---
>  src/spice-streaming-agent.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index f9d8855..26fa910 100644
> --- a/src/spice-streaming-agent.cpp
> +++ b/src/spice-streaming-agent.cpp
> @@ -623,10 +623,14 @@ int main(int argc, char* argv[])
>          FrameLog frame_log(log_filename, log_binary);
>          agent.CaptureLoop(streamfd, frame_log);
>      }
> -    catch (std::runtime_error &err) {
> +    catch (std::exception &err) {
>          syslog(LOG_ERR, "%s\n", err.what());
>          ret = EXIT_FAILURE;
>      }
> +    catch (...) {
> +        syslog(LOG_ERR, "Unexpected exception caught (probably thronw by plugin init");

Typo. Is it still technically an exception if it is not derived from
std::exception? I wouldn't call it so, it can be std::string.

I don't like the speculation in the error message. What we should
really do is catch exceptions from plugin init directly and log it
accordingly (and also not necessarily abort the agent, let it run
without the faulty plugin).

Lukas

> +        ret = EXIT_FAILURE;
> +    }
>  
>      closelog();
>      return ret;
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]