THRIFT-4549 Thrift exceptions should derive from TException
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/delphi/src/Thrift.pas b/lib/delphi/src/Thrift.pas
index 6eca3c9..ddd4c11 100644
--- a/lib/delphi/src/Thrift.pas
+++ b/lib/delphi/src/Thrift.pas
@@ -22,15 +22,19 @@
interface
uses
- SysUtils, Thrift.Protocol;
+ SysUtils,
+ Thrift.Exception,
+ Thrift.Protocol;
const
Version = '1.0.0-dev';
type
+ TException = Thrift.Exception.TException; // compatibility alias
+
TApplicationExceptionSpecializedClass = class of TApplicationExceptionSpecialized;
- TApplicationException = class( SysUtils.Exception )
+ TApplicationException = class( TException)
public
type
{$SCOPEDENUMS ON}
@@ -83,31 +87,9 @@
TApplicationExceptionInvalidProtocol = class (TApplicationExceptionSpecialized);
TApplicationExceptionUnsupportedClientType = class (TApplicationExceptionSpecialized);
- // base class for IDL-generated exceptions
- TException = class( SysUtils.Exception)
- public
- function Message : string; // hide inherited property: allow read, but prevent accidental writes
- procedure UpdateMessageProperty; // update inherited message property with toString()
- end;
implementation
-{ TException }
-
-function TException.Message;
-// allow read (exception summary), but prevent accidental writes
-// read will return the exception summary
-begin
- result := Self.ToString;
-end;
-
-procedure TException.UpdateMessageProperty;
-// Update the inherited Message property to better conform to standard behaviour.
-// Nice benefit: The IDE is now able to show the exception message again.
-begin
- inherited Message := Self.ToString; // produces a summary text
-end;
-
{ TApplicationException }
function TApplicationException.GetType: TExceptionType;