Re: [Lapackpp-devel] error handling
Status: Beta
Brought to you by:
cstim
From: Dominik W. <dom...@ar...> - 2006-11-24 15:26:14
|
> As for the output - I think this is usually redirected to ~/.xsession-errors, What's the Windows pendant? > and you could just as well redirect the stdout of your GUI-Tool to somewhere else. Unfortunately I'm not programming the GUI at all. I just programm another library used by a GUI. Somewhat complicated here... > and at the next failed assert() you will get a thrown LaException instead of > a failed assert. Is this what you wanted? I will take a look at it. Maybe I should describe how I do my error handling in libraries. :) I have a special static class called MyMessage with different enums for each error that can occur. If in a function an error occures I do MyMessage::Set(ERROR_DEFINEMENT, "Class::FunctionA"); return(true); The functionB that called this failed functionA sees in the return argument that something went wrong. It now can decide if to goes one or do MyMessage::Append("Class::FunctionB"); return(true); In this way I will create an error stack in the static class. At top level (that means in the GUI in most cases) I finally now can get the error and the stack MyMessage::GetMessage() and MyMessage::GetStack() and give the user a correct output. This means in a console application a console output, in a GUI-app maybe a little window message. Further sometimes the user can decide what he wants to do now. In most cases he should copy the message, save all his data (as far as this is possible) and send a bug report to me. But if the GUI just crashes (maybe after an hour of computing something) without any output the user may become a little impatient. ;) I know that this is complicated especially implementing the return values of all functions (it took me a dew days to change my code.) And now I could not return something else but do most things by call by reference. The advantage of it is that my library (or better the program of a user with my library) never crashes unless the programmer does not catch my error output and just go on as nothing happens. You can read something about this indirect error control in Piegl/Tiller: "The NURBS Book", p. 607, chapter "B-spline Programming Concept / Error control". There my be better programming books for it but this one explained it clear enough. :) Greetings, Dominik |