I'm trying to change the text of error messages, for example the following:

DBD::SQLite::db do failed: table X already exists(1) at dbdimp.c line 269

>From the user's point of view, "table X already exists" is valuable
information, but "at dbdimp.c line 269" is useless.

I've attempted to do this using the HandleError attribute with a function:

sub handle_error {
   $_[0] =~ s/ at dbdimp.c line \d+//;
   print STDERR "db error: $_[0]\n";   # for debug
   return 0;
}

The print statement shows the handler is changing the error text, but
the contents of $DBI:errstr on return from an offending statement show
the original text.

How can I do this?
 
- Will

Reply via email to