Skip to content

Return 500 for non numeric exception codes#15

Merged
veewee merged 1 commit intophpro:masterfrom
veewee:non-numeric-error-codes
May 21, 2021
Merged

Return 500 for non numeric exception codes#15
veewee merged 1 commit intophpro:masterfrom
veewee:non-numeric-error-codes

Conversation

@veewee
Copy link
Contributor

@veewee veewee commented May 21, 2021

Q A
Type bug
BC Break no
Fixed issues #14

Summary

>>> $exceptionCode = "42S02"
=> "42S02"
>>> $statusCode = $exceptionCode >= 400 && $exceptionCode <= 599 ? $exceptionCode : 500
=> "42S02"

Expected behaviour

An exception passed to Phpro\ApiProblem\Http\ExceptionApiProblem that returns a non-numeric getStatus() (and they do exist) should result in a code of 500, and not throw another exception complaining about the non-numeric status code that it tries to use to pass to the parent constructor (class Phpro\ApiProblem\Http\HttpApiProblem).

@veewee veewee force-pushed the non-numeric-error-codes branch from daa8544 to f98f521 Compare May 21, 2021 07:58
@veewee veewee merged commit af35ef0 into phpro:master May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants