Thread overview | |||||
---|---|---|---|---|---|
|
August 05, 2004 d breaks execution on every error? | ||||
---|---|---|---|---|
| ||||
on every error my program breaks execution with some error message. is there way to override this behavior? exactly: when i pass wrong URI format (%ausdua) to std.uri.decode i says "Error: URI error ". there are case where i can not ensure right format or i want to allow errors (for instance - user input on web page) |
August 05, 2004 Re: d breaks execution on every error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | In article <ceu706$24sg$1@digitaldaemon.com>, bobef says... > >on every error my program breaks execution with some error message. is there way to override this behavior? > >exactly: when i pass wrong URI format (%ausdua) to std.uri.decode i says "Error: URI error ". there are case where i can not ensure right format or i want to allow errors (for instance - user input on web page) I think you need to use try/catch: http://www.digitalmars.com/d/statement.html#try I put an example here: http://www.dsource.org/tutorials/index.php?show_example=33 jcc7 |
August 05, 2004 Re: d breaks execution on every error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | In article <ceu706$24sg$1@digitaldaemon.com>, bobef says... > >on every error my program breaks execution with some error message. is there way to override this behavior? > >exactly: when i pass wrong URI format (%ausdua) to std.uri.decode i says "Error: URI error ". there are case where i can not ensure right format or i want to allow errors (for instance - user input on web page) The functions in std.utf throw exceptions on failure. To get around this you'll want to do something like this: # try { # decode( ... ); # } catch( UtfError e ) { # printf( "UTF Error: %.*s\n", e.toString() ); # } Sean |
Copyright © 1999-2021 by the D Language Foundation