You are not logged in.
Arnaud,
Why the sqlite3 exceptions are eaten in TSQLRestServerDB.Commit, as shown below?
procedure TSQLRestServerDB.Commit(SessionID: cardinal=1);
begin
inherited Commit(SessionID); // reset fTransactionActive + write all TSQLVirtualTableJSON
try
DB.Commit;
except
on ESQLite3Exception do
; // just catch exception
end;
end;
I think there are many cases we need the flexibility of being able to catch the sqlite 3 exceptions and handle accordingly.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Found another place that also eats the sqlite errors silently:
TSQLRestServerDB.EngineExecute();
Begin
...
{$ifdef WITHLOG}
DB.Log.Log(sllError,'% for %',[E,aSQL],self);
{$else}
LogToTextFile('TSQLRestServerDB.EngineExecute: '+RawUTF8(E.Message)+#13#10+aSQL);
{$endif}
...
end;
I think when withlog is not defined, just call raise, give our programs the chance to get the exact error and handle accordingly. Handling errors with exceptions, instead of IF statements, are a commonly accepted concept, IIRC.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Both Commit and RollBack are procedures, so do not return any error boolean flag.
Perhaps it is an issue, but their execution is expected to continue.
EngineExecute returns an error boolean flag.
In all case, any Exception would be logged on the server side.
Online
Arnaud,
Is there an option to get over the currently forced logging and let us handle the errors?
Both Commit and RollBack are procedures, so do not return any error boolean flag.
Perhaps it is an issue, but their execution is expected to continue.EngineExecute returns an error boolean flag.
In all case, any Exception would be logged on the server side.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Online
edwinsn wrote:Is there an option to get over the currently forced logging and let us handle the errors?
Not at TSQLRest level.
Just at SynSQlite3 level.
So would you accept this as an option to disabled the logging and let us handle exceptions, at TSQLRest level?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Ok. So with the current implementation, what do you think to be the best way of getting the real sqlitedb errors? Like this?
if myRestServer.Add(...) < 1 then
beign
GetTheLatestServerLogEntry() //how?
end
How? Your help will be appreciated!
Last edited by edwinsn (2014-07-30 15:05:47)
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Sadly, in a multi-threaded server, and even more from a remote client, such a pattern would not work.
You can't be sure that there won't be any other error between the Add() and the GetTheLatestServerLogEntry().
Online
Arnaud,
I am not limited to the last server log entry, what I want is to get notified when there is a database error and know where to look for the error messages that really tell the true problem.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline