The Right Approach to Exceptions

dennis luehring dl.soluz at gmx.net
Mon Feb 20 22:54:17 PST 2012


Am 20.02.2012 21:49, schrieb Andrei Alexandrescu:
> On 2/20/12 1:32 PM, Juan Manuel Cabo wrote:
>>  So, if your boss wants the URL of the request that was made
>>  when the standard library threw you a FileNotFoundException,
>>  you can do:
>>
>>
>>  	try {
>>  	...
>>           } catch (Exception ex) {
>>                   //Rethrow the exception with the added detail:
>>  		ex.details["custom_url"] = getenv("URI");
>>                   throw ex;
>>           }
>
> That's a very interesting angle!
>
> Andrei
>
>

that is sooooo bad - fuck signatures just add information ...

now im able to just catch always Exception (sweet) ... but my damn 
handle code needs to know the real interface ... crippled into 
details["custom_url"]... so in the end we will come to if( detail[x] is 
in there) if( detail[y] is in there ) if ( detail[z] is in threre ) shit

i agree 100% - its easy for just giving out the information, but awfull 
for handling the exception


More information about the Digitalmars-d mailing list