phpro / api-problem

RFC7807 Problem details implementation
MIT License
65 stars 8 forks source link

Return 500 for non numeric exception codes #15

Closed veewee closed 3 years ago

veewee commented 3 years ago
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).