Error checking // List of all errors

Bart Pietercil bart.pietercil at gmail.com
Fri Sep 21 06:50:02 CDT 2007


On 21-sep-07, at 13:02, Ivan Smahin wrote:

>
> We can solve it just now in such a way:
>
>
> ...
> EXCEPTION
>     WHEN 50000 THEN
>       SET errNumber = SELECT lastError();
>       SET errMessage = SELECT lastErrorMsg();
>       CALL errHandler( errNumber, errMessage );
>     WHEN OTHERS THEN
>       SET errNumber = SELECT lastError();
>       SET errMessage = SELECT lastErrorMsg();
>       CALL errHandler( errNumber, errMessage );
> END;
>
>
> Is it good enough?
> Any ideas?


You mean that this already works in 3.3 ?

If Ruslan can remove the WHEN dependency (see previous post) I  
suppose it will look like this:

Exception
call errHandler();
End

and Errhandler would look like this
Begin
	
	set @lasterrNumber = select lastError()
	set @lasterrMessage = select ErrMessage from ErrTable where  
Errnumber = errNumber AND language = @userlanguage
	case @lasterrNumber = 1
		do appropriate stuff
	case....


end

This already looks good, maybe it would be possible to have a general  
on error event that could be set for the whole db.

on error
	call errHandler
end

This would avoid having to type in every procedure the Exception  
block, UNLESS one overwrites it in the Exception block of a procedure.

As for other ideas, I would like to retrieve the table that generated  
the errorcondition AND the query that triggered the errorcondition.  
This would make debugging complex stored procedures a LOT easier.

My 2 cents


Bart




More information about the Valentina mailing list