Skip to content

Latest commit

 

History

History
92 lines (64 loc) · 1.92 KB

File metadata and controls

92 lines (64 loc) · 1.92 KB

MethodNotAllowedException

Namespace: BhrSdk\Exceptions
Extends: ClientException
HTTP Status Code: 405

Description

Method not allowed

Usage

try {
    // API call that might fail with 405 status code
} catch (BhrSdk\Exceptions\MethodNotAllowedException $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();
}

Potential Causes

  • Using an incorrect HTTP method for this endpoint
  • The endpoint does not support the requested operation
  • API version mismatch

Debugging Tips

  • Check API documentation for the correct HTTP method (GET, POST, PUT, DELETE)
  • Verify the endpoint supports the operation you are attempting
  • Ensure you are using the correct API version

Constructor

public function __construct(
    string $message,
    array $responseHeaders = [],
    $responseBody = null
)

Parameters

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

Methods

getPotentialCauses()

Returns an array of potential causes for this exception.

public function getPotentialCauses(): array

getDebuggingTips()

Returns an array of debugging tips for this exception.

public function getDebuggingTips(): array

getResponseHeaders()

Returns the HTTP response headers from the API call that triggered this exception.

public function getResponseHeaders(): array

getResponseBody()

Returns the HTTP response body from the API call that triggered this exception.

public function getResponseBody()