Paul POULAIN wrote:
What is a shame is that the librarian can enter something, enter "OK", and ... see nothing ... the value hasn't be added due to a FK error, and nothing on the browser : everything seems OK ! Quite annoying for the librarian !
Her is why: C4::Context creates the database connection as follows: my $dbh= DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_passwd) What is missing is the options arg: { RaiseError => 1} V. important!
We can't ask the librarian to look in error.log ! So we need to display something on the browser, like "Oups, something goes wrong. Ask the Koha team and specify the following problem : "FK contraint at xxxxx.pm, line YYY, koha version X.XX.XX.XXX" "
Fortunatly, those errors are very uncommon, and I think I've seen them occuring only when a part of the DB has been entered through SQL insert & not the browser. But we should trap that anyway ! (as we should trap any SQL error)
This all relates to the application architecture. Is error handling to be done by checking error codes and responding accordingly, or are exceptions to be used? BTW: We should trap *any* error. cheers rickw -- _________________________________ Rick Welykochy || Praxis Services Censorship is telling a man he can't have a steak just because a baby can't chew it. -- Attributed to Mark Twain