why are we catching std::bad_alloc ?

Matteo Casalin matteo.casalin at gmx.com
Fri Jan 4 03:21:10 PST 2013


On 01/04/2013 08:53 AM, Noel Grandin wrote:
>
> Why are we catching std::bad_alloc all over the place?
>
>      git grep 'catch.*bad_alloc' | wc -l
>      68
>
> Surely we should just let it crash?
> Or have a single handler for the whole process that at least attempts to
> provide some debugging data?

I agree that "no memory" is a kind of thing that could not allow to take 
proper reactions (in which case the whole system would be unusable), but 
when possible I think that an error message of any kind (together with 
debugging data) would at least make the user feel that the developers 
and the program are trying their best to offer a good and safe 
experience and careful data handling, making her more willing to provide 
useful information to fix the problem. If a program just crash, a 
possible user reaction could be "why should I use it?". This is 
especially true if there are alternatives.

Cheers
Matteo

> At the moment, most of them just log something and then continues, which
> strikes me as counter-productive.
>
>
> Disclaimer: http://www.peralex.com/disclaimer.html
>
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>



More information about the LibreOffice mailing list