Text in EIBCError.Message

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Boro
Posts: 21
Joined: Wed 19 Sep 2007 21:58

Text in EIBCError.Message

Post by Boro » Fri 05 Oct 2007 00:17

Hallo,

when raising custom exception in a stored procedure, the try-except block catches EIBCError. The property Message inherited from class Exception containes not only my customized message, but also the exception name and ID, and also the sentence 'At procedure MyProcName'

Please, how can I customize the whole message in the Message property ?

Thanks in advance for any hints

Boro

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 05 Oct 2007 07:25

To customize the error message, you can catch the exception, and copy a necessary part of it. Search char #13 in the message to get position of line end.

Boro
Posts: 21
Joined: Wed 19 Sep 2007 21:58

Post by Boro » Fri 05 Oct 2007 09:17

To customize the error message, you can catch the exception
In this case it is already a catched and customized exception.
I created the exception with its text in the db. It has the exception ID 12, and a name I have assigned. Inside the procedure when a select into doesn't return the right data I am raising this exception using SQL statement EXCEPTION ... And in this statement I am again assigning a more customized message (filled with some info).

What I am surprised with, is that in the IDBCError.Message property isn't only my customized one, but it is surrounded by additional infos. For example
exception 12
- exception object's id I created
EX_STOCKNUMBAD
- exception's name I created
Item V555 doesn't exist
- my own more customized msg, from the point of rising it.
At procedure 'SP_SAVE_HEADIN'
- proc.name

It is fine you make these info avalable. But it would be much better if you put them into separate properties instead of clatching them all into one text delimited by #13 character. And the exception ID or proc.name you have to extract even from the line of text at some special position ...

I do not want to criticise you. I am satisified with IBDAC untill now as I am in the beginning of learning it.

Boro

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 08 Oct 2007 08:15

IBDAC gets an error message from the InterBase client, and puts this text to the Message property of TIBCError 'as is'. So format of error messages depends on InterBase client and server.

We'll consider possibility to parse error messages in IBDAC, but that is hardly to happen in the nearest future.

Post Reply