blob: 5d15c36569062682fa75037e6ddad41ff3dba192 [file] [log] [blame]
Jens Geyer606f1ef2018-04-09 23:09:41 +02001(*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *)
19
20{$SCOPEDENUMS ON}
21
22unit Thrift.Exception;
23
24interface
25
26uses
27 Classes, SysUtils;
28
29type
30 // base class for all Thrift exceptions
31 TException = class( SysUtils.Exception)
32 public
33 function Message : string; // hide inherited property: allow read, but prevent accidental writes
34 procedure UpdateMessageProperty; // update inherited message property with toString()
35 end;
36
37
38
39
40implementation
41
42{ TException }
43
44function TException.Message;
45// allow read (exception summary), but prevent accidental writes
46// read will return the exception summary
47begin
48 result := Self.ToString;
49end;
50
51procedure TException.UpdateMessageProperty;
52// Update the inherited Message property to better conform to standard behaviour.
53// Nice benefit: The IDE is now able to show the exception message again.
54begin
55 inherited Message := Self.ToString; // produces a summary text
56end;
57
58
59
60
61end.
62