Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wright <tom@inflatablecookie.com>
  • Loading branch information
betterthanclay committed Aug 22, 2024
1 parent 9766e99 commit 3f441b1
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ throw Exceptional::{'NotFound,BadMethodCall'}(
);

// You can associate a http code too..
throw Exceptional::CompletelyMadeUpMeaning('My message', [
'code' => 1234,
'http' => 501
]);
throw Exceptional::CompletelyMadeUpMeaning(
message: 'My message',
code: 1234,
http: 501
);

// Implement already existing Exception interfaces
throw Exceptional::{'InvalidArgument,Psr\\Cache\\InvalidArgumentException'}(
'Cache items must implement Cache\\IItem',
['http' => 500], // params
$item // data
message: 'Cache items must implement Cache\\IItem',
http: 500,
data: $item
);

// Reference interfaces using a path style
Expand Down Expand Up @@ -99,9 +100,12 @@ trait BadThingExceptionTrait {
class Thing {

public function doAThing() {
throw Exceptional::BadThing('A bad thing happened', [
'customData' => 'My custom info'
]);
throw Exceptional::BadThing(
message: 'A bad thing happened',
data: [
'customData' => 'My custom info'
]
);
}
}
```
Expand Down

0 comments on commit 3f441b1

Please sign in to comment.