summaryrefslogtreecommitdiff
path: root/lib/delphi/src/Thrift.pas
diff options
context:
space:
mode:
Diffstat (limited to 'lib/delphi/src/Thrift.pas')
-rw-r--r--lib/delphi/src/Thrift.pas17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/delphi/src/Thrift.pas b/lib/delphi/src/Thrift.pas
index 50513d35d..dceb256c6 100644
--- a/lib/delphi/src/Thrift.pas
+++ b/lib/delphi/src/Thrift.pas
@@ -60,17 +60,26 @@ type
// base class for IDL-generated exceptions
TException = class( SysUtils.Exception)
public
- procedure Message; // hide inherited property to prevent accidental read/write
+ function Message : string; // hide inherited property: allow read, but prevent accidental writes
+ procedure UpdateMessageProperty; // update inherited message property with toString()
end;
implementation
{ TException }
-procedure TException.Message;
-// hide inherited property to prevent accidental read/write
+function TException.Message;
+// allow read (exception summary), but prevent accidental writes
+// read will return the exception summary
begin
- ASSERT( FALSE, 'Unexpected call to '+ClassName+'.message. Forgot the underscore?');
+ 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 }