|
From: Ermete G. <ex...@li...> - 2004-05-27 15:35:55
|
<html> Hi to all<br> I developed an exception class for another project and I found it very useful.<br> At the moment I used it for the PAQ Files project and I made it parametric so we can decide if keep it or not.<br> We can choose to use it or not and if yes to move it into the misc package<br><br> This class saves internally a copy of the errno variable and GetLastError (only on Windows) and report them when the exception is converted to string. It also supports multiple error messages arranged in a stack.<br> For example:<br> I ask the file handler to opena file and an exception is generated "CreateFile failed". I catch the exception, add the message "Error opening the file <xenocide.conf>" and I throw it again.<br><br> when the toString() method is invoked the generated text is:<br> <b>FileNotFoundException:<br> Error opening the file <xenocide.conf><br> CreateFile failed<br> - GetLastError() reported: "Insufficient privileges"<br> - errno reported: "no error"<br><br> </b>What you think about it?<br><br> Exio82<br> </html> |