@@ -43,6 +43,28 @@ The package allows objects to be instantiated with a single argument.
4343
4444The package allows objects to be instantiated with key-value arguments.
4545
46+ # ATTRIBUTES
47+
48+ This package has the following attributes:
49+
50+ ## context
51+
52+ context(Any)
53+
54+ This attribute is read-only, accepts ` (Any) ` values, and is optional.
55+
56+ ## id
57+
58+ id(Str)
59+
60+ This attribute is read-only, accepts ` (Str) ` values, and is optional.
61+
62+ ## message
63+
64+ message(Str)
65+
66+ This attribute is read-only, accepts ` (Str) ` values, and is optional.
67+
4668# METHODS
4769
4870This package implements the following methods:
@@ -63,18 +85,34 @@ The explain method returns an error message with stack trace.
6385
6486## throw
6587
66- throw(Str $class , Any $context, Maybe[Number] $offset) : Any
88+ throw(Tuple[ Str, Str] | Str $message , Any $context, Maybe[Number] $offset) : Any
6789
68- The throw method throws an error with message.
90+ The throw method throws an error with message (and optionally, an ID) .
6991
7092- throw example #1
7193
7294 use Data::Object::Exception;
7395
96+ my $exception = Data::Object::Exception->new;
97+
98+ $exception->throw('Oops!')
99+
100+ - throw example #2
101+
102+ use Data::Object::Exception;
103+
74104 my $exception = Data::Object::Exception->new('Oops!');
75105
76106 $exception->throw
77107
108+ - throw example #3
109+
110+ use Data::Object::Exception;
111+
112+ my $exception = Data::Object::Exception->new;
113+
114+ $exception->throw(['E001', 'Oops!'])
115+
78116## trace
79117
80118 trace(Int $offset, $Int $limit) : Object
0 commit comments