Skip to content

Commit 6c38e93

Browse files
Merge pull request #42 from php-enspired/signaling
Signaling
2 parents d13e3a7 + 8fb7887 commit 6c38e93

7 files changed

Lines changed: 26 additions & 25 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Augmented features for exceptions and exception handling.",
44
"type": "library",
55
"homepage": "https://php.enspi.red",
6-
"license": "GPL-3.0-only",
6+
"license": "MPL-2.0",
77
"authors": [
88
{
99
"name": "Adrian",

docs/API:-The-Exceptable-Interface.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ properties
77
----------
88

99
---
10-
### readonly array `Exceptable::context`
10+
### readonly array `$context`
1111

1212
User-provided contextual information for this exception.
1313

@@ -26,25 +26,25 @@ For each of these, the following are also available for message formatting:
2626
- ? Fault `__{exception}Fault__`: the fault that the exception/previous/root was built from, if any.
2727

2828
---
29-
### readonly Fault `Exceptable::fault`
29+
### readonly Fault `$fault`
3030

3131
The Fault instance that this Exceptable was build from.
3232

3333
---
34-
### readonly ? Throwable `Exceptable::previous`
34+
### readonly ? Throwable `$previous`
3535

3636
The previous exception, if any.
3737

3838
---
39-
### readonly Throwable `Exceptable::root`
39+
### readonly Throwable `$root`
4040

4141
The original (most-previous) exception in this exception's chain. This may be the same as the top-level or previous exception.
4242

4343
methods
4444
-------
4545

4646
---
47-
### `Exceptable::__construct(Fault $fault [, array $context] [, Throwable $previous])`
47+
### `__construct(Fault $fault [, array $context] [, Throwable $previous])`
4848

4949
Constructs a new Exceptable instance from a Fault.
5050

@@ -54,7 +54,7 @@ Constructs a new Exceptable instance from a Fault.
5454
- Throwable `$previous` The previous exception, if any.
5555

5656
---
57-
### bool `Exceptable::has(Fault $fault)`
57+
### bool `has(Fault $fault)`
5858

5959
Checks whether this Exceptable contains the given Fault, anywhere in its exception chain.
6060

@@ -65,7 +65,7 @@ Checks whether this Exceptable contains the given Fault, anywhere in its excepti
6565
- boolean
6666

6767
---
68-
### bool `Exceptable::is(Fault $fault)`
68+
### bool `is(Fault $fault)`
6969

7070
Checks whether this Exceptable was built from the given Fault.
7171

@@ -78,6 +78,7 @@ Checks whether this Exceptable was built from the given Fault.
7878
inherited methods
7979
-----------------
8080

81+
---
8182
Inherited from [Throwable](https://php.net/throwable):
8283
- string `getMessage()`
8384
- int `getCode()`

docs/API:-The-ExceptableFault-Class.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ An error occured but its details are not available.
4949
exceptables
5050
-----------
5151

52+
---
5253
- `LogicException`: thrown for `UnknwonFault`, `UnacceptableFault`
5354
- `RuntimeException`: thrown for `UncaughtException`
5455
- `InvalidArgumentException`: thrown for `UnacceptableLogMessage`, `UnknownError`

docs/API:-The-Fault-Interface.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ Builds an Exceptable from this Fault, using the provided contextual information
5757
inherited methods
5858
-----------------
5959

60+
---
6061
Inherited from [`JsonSerializable`](https://php.net/JsonSerializable):
6162
- mixed `jsonSerialize()`

docs/API:-The-SplFault-Class.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ A value does not match with a set of values.
7575
exceptables
7676
-----------
7777

78+
---
7879
Corresponding Exceptable classes are provided for each SplFault case. Each also extends from the core SPL exception class of the same name, sharing semantic meaning and allowing interoperability with code that is unaware of the exceptable types.
7980

8081
- `at\exceptable\Spl\BadFunctionCallException` extends `BadFunctionCallException`

docs/Usage:-Faults-and-Exceptables.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@ enum ProcessFault implements Fault {
2424

2525
Seriously? Yes, seriously, that's it. If you want to skip to the end now you can. Go ahead and start writing your application code, returning and/or throwing these faults.
2626

27+
### error messages
28+
2729
You can build messages for your faults using the intl extension and ICU resource bundles. If you don't, then the error message will just be the name of the fault.
2830

2931
```php
32+
<?php
33+
use at\peekaboo\MessageRegistry;
34+
3035
$context = [
3136
"type" => "Example",
3237
"status" => "preparing"
@@ -60,13 +65,13 @@ echo ProcessFault::NotReady->message($context);
6065
// prints:
6166
// ProcessFault.NotReady: Example is not ready (status is 'preparing')
6267
```
63-
_Note, using `EnumeratesFaults` means the fault will_ never _try to look up messages on your registered message bundles. The `makeMessage()` method is still available, and_ will _look up messages if they are registered, but is not used internally._
68+
> Note, using `EnumeratesFaults` means the fault will _never_ try to look up messages on your registered message bundles. The `makeMessage()` method is still available, and _will_ look up messages if they are registered, but is not used internally.
6469
6570
### customized behavior
6671

6772
Sensible default behavior is provided by `IsFault` and `EnumeratesFaults`, but there are some aspects that can be customized.
6873

69-
During development, it is _highly_ recommended that you enable assertion checking. The exceptable library uses assertions to sanity-check your modifications - for example, that `exceptableType()` returns a suitable classname. In production, assertions can be safely disabled (and generally, should).
74+
> Note, During development, it is _highly_ recommended that you enable assertion checking. The exceptable library uses assertions to sanity-check your modifications - for example, that `exceptableType()` returns a suitable classname. In production, assertions can be safely disabled (and generally, should).
7075
7176
#### changing what `Exceptable` type is thrown
7277

docs/_Sidebar.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
# Contents
22

3-
### 3.0 is Coming Soon!
4-
5-
- [New in 3.0](https://github.com/php-enspired/exceptable/wiki/New-in-3.0)
6-
73
### Usage
8-
9-
- [Exceptables](https://github.com/php-enspired/exceptable/wiki/Usage:-Exceptables)
10-
- [Spl Exceptables](https://github.com/php-enspired/exceptable/wiki/Usage:-SPL-Exception-Classes)
11-
- [Handlers](https://github.com/php-enspired/exceptable/wiki/API:-The-Handler-Class)
12-
- [Making and Testing Exceptables for Your Own Project (coming soon!)](#)
4+
- [Faults and Exceptables](https://github.com/php-enspired/exceptable/wiki/Usage:-Faults-and-Exceptables)
5+
- [Spl Faults and Exceptables](https://github.com/php-enspired/exceptable/wiki/Usage:-Spl-Faults-and-Exceptables)
6+
- [Handlers](https://github.com/php-enspired/exceptable/wiki/Usage:-Handlers)
137

148
### Api
15-
9+
- [The `Fault` Interface](https://github.com/php-enspired/exceptable/wiki/API:-The-Fault-Interface)
1610
- [The `Exceptable` Interface](https://github.com/php-enspired/exceptable/wiki/API:-The-Exceptable-Interface)
17-
- [The `Handler` Class](https://github.com/php-enspired/exceptable/wiki/Usage:-Handlers)
18-
19-
### More
20-
21-
- [Docs and the Wiki](https://github.com/php-enspired/exceptable/wiki/Docs-and-Wiki)
11+
- [The `SplFault` Class](https://github.com/php-enspired/exceptable/wiki/API:-The-SplFault-Class)
12+
- [The `ExceptableFault` Class](https://github.com/php-enspired/exceptable/wiki/API:-The-ExceptableFault-Class)
13+
- [The `Handler` Class](https://github.com/php-enspired/exceptable/wiki/API:-The-Handler-Class)

0 commit comments

Comments
 (0)