FR: have the errors as an internal errortable
Bart Pietercil
bart.pietercil at gmail.com
Mon Sep 24 07:47:28 CDT 2007
On 24-sep-07, at 14:13, Ivan Smahin wrote:
> Hello Bart,
>
> Monday, September 24, 2007, 12:27:09 PM, you wrote:
>
>> Hi List, Ruslan et all,
>
>> When thinking about errorreporting this weekend I thought I would
>> introduce a feature request to have the errors.xml file available to
>> the engine. This way I could build an ErrorProcedure that started
>> with a select statement, selecting the error txt.
>> However as I read my mail this morning I understand that there will
>> be an @@lasterrorid and @@lasterrormessage. So if I understand it
>> this takes care of having to select the errormessage and we can just
>> go ahead and 'print' the errormessage through @@lasterrormessage.
>
>> Did I understand this correct ?
>
> Correct.
> Please keep in mind a couple of things:
> 1. That variables are initialized if some exception is thrown
> inside
> some stored procedure only.
>
> 2. @@LastErrorNumber contains hex value. You can use new sql-function
> to show its string representation: HEX
>
> SELECT HEX(@@LastErrorNumber), @@LastErrorMessage;
>
>
>
Okay thanks
>> Some thoughts about error reporting
>
>> As it stands now there is no way of saying that our errorProcedure
>> should ALWAYS be used, is there ? Maybe I should explain:
>> Now we need to explicitly call in an exception block of a stored
>> procedure the errorProcedure in order to trigger it. I think it would
>> be better if a developer would be able to specify that the
>> errorProcedure should always be used when an error occurs (not only
>> when called from a stored procedure but also when a query launched
>> through an API generates an error. This way error handling would be
>> as close as possible to the engine and as close as possible to the
>> developer (the one making the mistakes :-)) and logging of what went
>> wrong would be a lot easier.
>
> Add it please as feature request.
> I see - you want to get something like a hook to register own
> "event"
> handlers. Particularly error handler. Need to think.
Right: set ErrorHook = call myCustomErrorHandler()
Then there is one more thing to round it off.
I think the errors.xml file belongs inside the engine as a systable
(maybe it already is). I'm hoping for a system where we can query the
system errors table (all defined errorstates) so that we can build
our own "sister"tables having the same errorid but translated error
messages and more elaborated comments so we can feed this back to the
calling API in a , for our users, more readable form
>
>
>> May I suggest that we will be needing an 'inTransaction' variable
>> which it will make it possible to do rollbacks inside the
>> errorprocedure (when transactions will be implemented).This way we
>> will be able to say when an error is handled
>
>> if inTransaction then
>> rollback
>> else
>> ...
>
> Why you need some flag to issue rollBack? You can rollback
> transaction at any moment.
Does that mean that transactions will be implicit ?
Or does that mean that there would not be a problem for calling
rollback without having a transaction?
Or do I just have to wait and see ;-)
>
>
>> Besides having the @@lasterrorid and the @@lasterrormessage it really
>> would like to see the @@lastquery. Again logging the errors together
>> with the querytext will make debugging A LOT easier if the 'guilty'
>> query is shown in the error log.
>
> Also, put it into Mantis please.
http://valentina-db.com/bt/view.php?id=2667
TIA
Bart Pietercil
More information about the Valentina
mailing list