Skip to content

Commit bb7d8f5

Browse files
committed
fix: crash instead of error dialog on FireDAC timeout on Interbase
1 parent ac0109a commit bb7d8f5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎source/dbconnection.pas‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5303,11 +5303,21 @@ function TInterbaseConnection.GetLastErrorCode: Cardinal;
53035303
procedure TInterbaseConnection.OnFdError(ASender: TObject; AInitiator: TObject; var AException: Exception);
53045304
var
53055305
oExc: EFDDBEngineException;
5306+
Msg: String;
53065307
begin
53075308
if AException is EFDDBEngineException then begin
53085309
oExc := EFDDBEngineException(AException);
53095310
FLastErrorCode := oExc.ErrorCode;
53105311
FLastError := oExc.Message;
5312+
end
5313+
else if AException is EFDException then begin
5314+
// Convert non-database FireDAC errors, e.g. "[FireDAC][Stan]-700. Timeout expired.",
5315+
// so connection attempts and query executions handle them as EDbError with a
5316+
// clean error dialog instead of an unhandled crash. FireDAC does not free
5317+
// the replaced exception object, so do that here.
5318+
Msg := AException.Message;
5319+
FreeAndNil(AException);
5320+
AException := EDbError.Create(Msg);
53115321
end;
53125322
end;
53135323

0 commit comments

Comments
 (0)