You are not logged in.
Pages: 1
I can find out using my debugger, but it would be so much better to have an 'GetLastError' solution, or maybe have an exception at client side raised that contains info about WHY the update failed.
Errors can haCOuld be e.g.
* the database rejected (key violation, invalid data etc) the update from the mOrmot
* mormot rejected the data
* communication failure/dropout
Currently it is quite hard (clienty side) to find out .
SUggestion:
find a way to catch/hold on to the "last" server side exception / exception message, and send it over to the client, either directly with the reply (not preferred due to bandwith considerations) or (preferably) in for form of a GetLastMotmotError:UTF8string / raiseLastMormotError solution that queries the server for the last exception/error info.
Hans
Offline
Good idea.
I've added a task to the RoadMap:
Refactor the Client-Server error process, with better transmission of the error raised on server side to identify the cause of a failure on client side;
Offline
Gr8!
Offline
Feature request raised again.
http://synopse.info/forum/viewtopic.php?id=1053
Offline
I also need this feature. For example in TSQLDBConnection.NewStatementPrepared database error go to nowhere. So it's impossible to get error message been raised on database level (only in log files). Aa solution may be add "var Err" to
function TSQLDBConnection.NewStatementPrepared(const aSQL: RawUTF8;
ExpectResults: Boolean; var Err: RawUTF8): TSQLDBStatement;
begin
try
result := NewStatement;
result.Prepare(aSQL,ExpectResults);
except
on E: Exception do
FreeAndNil(result);
Err := StringToUTF8(E.Message)
end;
end;
and push it up to NewThreadSafeStatementPrepared level?
Offline
1. I've added TSQLRestClientURI.LastErrorCode/LastErrorMessage/LastErrorException properties, to retrieve additional information about remote URL() execution.
It will allow to retrieve the error on client side, as returned by the RESTful request.
See http://synopse.info/fossil/info/f2733cdb53
2. I've added RaiseExceptionOnError: boolean=false optional parameter to TSQLDBConnection.NewStatementPrepared() method, and TSQLDBConnection.LastErrorMessage and LastErrorException properties, to retrieve the error when NewStatementPrepared() returned nil.
This would help to better handle errors in SynDB* units, as mpv expected.
See http://synopse.info/fossil/info/5f4d9a1c8b
Feedback is welcome.
Offline
Thanks Arnaud.
I have some questions.
I just do not know when the server connection is working or not.
I have this code:
Client:= TSQLHttpClient.Create = ('127 .0.0.1 ', '888', Model);
Is there any way to test if a connection to the server is ok?
In the example that I put in this post http://synopse.info/forum/viewtopic.php?id=1053
There is still no solution for this, right?
Offline
Just check the LastErrorException property if the method returned FALSE or 0 (meaning error): you should have a timeout exception here.
There is no such "ping" feature available, due to the nature of HTTP clients.
Offline
I just do not have the server started.
After this line
Client:= TSQLHttpClient.Create = ('127 .0.0.1 ', '888', Model);
the Client.LastErrorException is nil.
Offline
TSQLHttpClient.Create() does not make any connection attempt.
You need to perform a remote RESTful command to connect.
I've just made a fix to TSQLHttpClientGeneric.InternalURI() method in order to raise an explicit exception on connection error.
See http://synopse.info/fossil/info/5721ad49cf
Now Client.ErrorMessage='Server not available (System Error. Code: 12029.)' for instance, with fLastErrorException=EOSError for TSQLHttpClientWinHTTP kind of connection.
So you can make such tests:
Client := TSQLHttpClient.Create('localhost','888',Model);
if not Client.SetUser('User','synopse') then begin
ShowMessage(UTF8ToString(Client.LastErrorMessage));
exit;
end;
If you want just to test the connection, you can try the newly added TSQLRestClientURI.ServerTimeStampSynchronize method.
See http://synopse.info/fossil/info/900710ea17
Thanks for the feedback.
Offline
Great! Good work. I was waiting for some code like this too
Last edited by Junior/RO (2013-02-01 20:58:09)
Offline
Pages: 1