Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F21687
README.md
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
README.md
View Options
[![
Latest
Stable
Version
]](
https
:
//packagist.org/packages/wikimedia/normalized-exception) [![License]](https://packagist.org/packages/wikimedia/normalized-exception)
NormalizedException
=====================
A
minimal
library
to
facilitate
[
PSR
-
3
][]-
friendly
exception
handling
.
Additional
documentation
about
the
library
can
be
found
on
[
MediaWiki
.
org
](
https
:
//www.mediawiki.org/wiki/NormalizedException).
Usage
-----
Use
the
standard
implementation
:
```
php
use
Wikimedia
\
NormalizedException
\
NormalizedException
;
throw
new
NormalizedException
(
'
Invalid
value
:
{
value
}
'
,
[
'
value
'
=>
$
value
]
);
```
Integrate
into
another
framework
or
library
:
```
php
use
Wikimedia
\
NormalizedException
\
INormalizedException
;
use
Wikimedia
\
NormalizedException
\
NormalizedExceptionTrait
;
class
MyException
extends
SomeException
implements
INormalizedException
{
use
NormalizedExceptionTrait
;
public
function
__construct
(
string
$
normalizedMessage
,
array
$
messageContext
=
[]
)
{
$
this
->
normalizedMessage
=
$
normalizedMessage
;
$
this
->
messageContext
=
$
messageContext
;
parent
::
__construct
(
self
::
getMessageFromNormalizedMessage
(
$
normalizedMessage
,
$
messageContext
)
);
}
}
```
```
php
throw
new
MyException
(
'
Invalid
value
:
{
value
}
'
,
[
'
value
'
=>
$
value
]
);
```
Running
tests
-------------
```
composer
install
--
dev
composer
test
```
History
-------
This
library
was
split
out
of
[
MediaWiki
][]
changeset
[
670465
][]
during
the
MediaWiki
1.37
development
cycle
.
---
[
PSR
-
3
]:
https
:
//www.php-fig.org/psr/psr-3/
[
MediaWiki
]:
https
:
//www.mediawiki.org/wiki/MediaWiki
[
670465
]:
https
:
//gerrit.wikimedia.org/r/c/mediawiki/core/+/670465
[
Latest
Stable
Version
]:
https
:
//poser.pugx.org/wikimedia/normalized-exception/v/stable.svg
[
License
]:
https
:
//poser.pugx.org/wikimedia/normalized-exception/license.svg
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 26, 18:18 (1 d, 1 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
22/bd/24a4a1a1832766daaa7c348d5e62
Default Alt Text
README.md (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment