Skip to content

Commit 6a2b207

Browse files
juanfJuan Ferrari
and
Juan Ferrari
authored
Fix exception not accepting code on the constructor. Fix 409 error to… (#68)
* Fix exception not accepting code on the constructor. Fix 409 error to match spec https://datatracker.ietf.org/doc/html/rfc7644#section-3.3 --------- Co-authored-by: Juan Ferrari <[email protected]>
1 parent 403b1b2 commit 6a2b207

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Exceptions/SCIMException.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ class SCIMException extends Exception
1212

1313
protected $errors = [];
1414

15-
public function __construct($message)
15+
public function __construct($message, $code = 404)
1616
{
17-
parent::__construct($message);
17+
parent::__construct($message, $code);
18+
$this->setCode($code);
1819
}
1920

2021
public function setScimType($scimType) : SCIMException

src/SCIM/Error.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function toJson($options = 0)
1919
"schemas" => ['urn:ietf:params:scim:api:messages:2.0:Error'],
2020
"detail" => $this->detail,
2121
"status" => $this->status,
22-
"scimType" => ($this->status == 400 ? $this->scimType : null),
22+
"scimType" => ($this->status == 400 ? $this->scimType : ($this->status == 409 ? 'uniqueness' : null)),
2323

2424
// not defined in SCIM 2.0
2525
'errors' => $this->errors

0 commit comments

Comments
 (0)