Error Firebird in Lazarus lazarus / 16-Databases ---------------------------------------------------------------------- calm_sea · 2023-02-23 11:03 Hi everyone. I can't find a way to catch firebird errors from lazarus. With IBEventMonitor I can acquire the errorcode but I can't get the string of the error. ---------------------------------------------------------------------- rvk · 2023-02-23 11:16 Quote from: calm_sea on February 23, 2023, 12:03:39 pmHi everyone. I can't find a way to catch firebird errors from lazarus. With IBEventMonitor I can acquire the errorcode but I can't get the string of the error. Can't you just use the try/except handling? It depends on the components used but if you use IBX. With the normal Exception: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i try  // do your thing with SQLexcept  on E: Exception do  begin    // your generic message is in E.Message    if (E is EIBInterBaseError) then  begin      // your errorcode is in EIBInterBaseError(E).IBErrorCode    // and sqlcode is in EIBInterBaseError(E).SQLCode    end;  end;end; If you only need to catch the EIBInterBaseError then you can do this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i try  // do your thing with SQLexcept  on E: EIBInterBaseError do  begin    // your errorcode is in EIBInterBaseError(E).IBErrorCode    // and sqlcode is in EIBInterBaseError(E).SQLCode  end;end; Other exceptions will pass through to the caller function. ---------------------------------------------------------------------- calm_sea · 2023-02-23 13:54 Yes, thanks. I was wondering if it's possible to centralize error handling across the whole db, not at the level of each specific query. I had thought that with IBEventManager it was possible, but I can't do it ---------------------------------------------------------------------- rvk · 2023-02-23 16:04 Quote from: calm_sea on February 23, 2023, 02:54:14 pmYes, thanks. I was wondering if it's possible to centralize error handling across the whole db, not at the level of each specific query. I had thought that with IBEventManager it was possible, but I can't do it No, not that I'm aware of. It wouldn't make sense to me because every part of your program (and DB handling) could require it's own special handling. If that's not the case you can just let the exception happen and handle it with the Application.OnException (you can write your own generic exception handler). ---------------------------------------------------------------------- calm_sea · 2023-03-20 12:44 OK thank you! One last thing. How can I get firebird error messages in Italian? Is there a firebird.msg file in Italian? ---------------------------------------------------------------------- rvk · 2023-03-20 13:49 Quote from: calm_sea on March 20, 2023, 01:44:25 pmIs there a firebird.msg file in Italian? Not that I know of. In the source there is a directory \src\msgs where the firebird.msg is build. There are translations in German en French. Not any other. (Maybe some third party has translated them once.) You could also make your own translation. But you can also catch exceptions program wide and translate them then. Besides, for most messages I would prefer the original English ones. Otherwise it's a lot harder to search the internet for solutions when you get those in another language. Only for the most common error codes (like DB not found and Record liked and some others) I provide translations. Edit: O, and IB EXpert had a tool for directly translating the Firebird.msg. http://www.ibexpert.net/ibe/index.php?n=Doc.LocalizeIBMessages ---------------------------------------------------------------------- dogriz · 2023-03-21 13:21 You can create your own exceptions in any language you like in Firebird with CREATE EXCEPTION ... Check employee demo database as an example.