Thread overview
d breaks execution on every error?
Aug 05, 2004
bobef
Aug 05, 2004
J C Calvarese
Aug 05, 2004
Sean Kelly
August 05, 2004
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
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
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