Browse Source

* Improved error-handling

git-svn-id: trunk@12288 -
joost 16 years ago
parent
commit
332fcd325d
1 changed files with 15 additions and 2 deletions
  1. 15 2
      packages/fcl-db/src/sqldb/oracle/oracleconnection.pp

+ 15 - 2
packages/fcl-db/src/sqldb/oracle/oracleconnection.pp

@@ -16,6 +16,11 @@ uses
   oratypes;
   oratypes;
 
 
 type
 type
+  EOraDatabaseError = class(EDatabaseError)
+    public
+      ORAErrorCode : Longint;
+  end;
+
   TOracleTrans = Class(TSQLHandle)
   TOracleTrans = Class(TSQLHandle)
     protected
     protected
   end;
   end;
@@ -92,10 +97,18 @@ procedure TOracleConnection.HandleError;
 
 
 var errcode : sb4;
 var errcode : sb4;
     buf     : array[0..1023] of char;
     buf     : array[0..1023] of char;
+    E       : EOraDatabaseError;
 
 
 begin
 begin
-  OCIErrorGet(FOciError,1,nil,errcode,@buf[1],1023,OCI_HTYPE_ERROR);
-  DatabaseErrorFmt(SErrOracle+LineEnding+buf,[inttostr(errcode)],self);
+  OCIErrorGet(FOciError,1,nil,errcode,@buf[0],1024,OCI_HTYPE_ERROR);
+
+  if (Self.Name <> '') then
+    E := EOraDatabaseError.CreateFmt('%s : %s',[Self.Name,buf])
+  else
+    E := EOraDatabaseError.Create(buf);
+
+  E.ORAErrorCode := errcode;
+  Raise E;
 end;
 end;
 
 
 procedure TOracleConnection.DoInternalConnect;
 procedure TOracleConnection.DoInternalConnect;