Namespace: BhrSdk\Exceptions
Extends: ClientException
HTTP Status Code: 422
Unprocessable entity
try {
// API call that might fail with 422 status code
} catch (BhrSdk\Exceptions\UnprocessableEntityException $e) {
// Handle the exception
echo $e->getMessage();
// Access additional information
$causes = $e->getPotentialCauses();
$tips = $e->getDebuggingTips();
// Access response data
$responseHeaders = $e->getResponseHeaders();
$responseBody = $e->getResponseBody();
}- Request syntax is correct but contains semantic errors
- Validation failures in the request data
- Business rule violations
- Data integrity constraints
- Check the response body for specific validation error details
- Ensure request data meets all business rules and constraints
- Validate data before submitting to the API
- Review API documentation for field requirements and limitations
public function __construct(
string $message,
array $responseHeaders = [],
$responseBody = null
)| Name | Type | Description |
|---|---|---|
$message |
string | The error message |
$responseHeaders |
array | HTTP response headers from the API call |
$responseBody |
mixed | HTTP response body from the API call |
Returns an array of potential causes for this exception.
public function getPotentialCauses(): arrayReturns an array of debugging tips for this exception.
public function getDebuggingTips(): arrayReturns the HTTP response headers from the API call that triggered this exception.
public function getResponseHeaders(): arrayReturns the HTTP response body from the API call that triggered this exception.
public function getResponseBody()