massaging error messages



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

.



Relevant Pages

  • Re: massaging error messages
    ... I've attempted to do this using the HandleError attribute with a function: ... The print statement shows the handler is changing the error text, ... I'll do that and post a patch including the above change. ... $db->do('insert into testerror values (1, ...
    (perl.dbi.users)
  • Re: massaging error messages
    ... I've attempted to do this using the HandleError attribute with a function: ... The print statement shows the handler is changing the error text, ... If you send me a patch that moves the HandleError tests from t/10examp.t ... into a separate file and adds a new test for this problem, ...
    (perl.dbi.users)
  • Re: Database Progress Bar
    ... If you're using Sql Server you can trap the InfoMessage event (include some ... print statement and even though they aren't error messages, ... back and you can bump the progress bar) ...
    (microsoft.public.dotnet.languages.csharp)