Since: 2024-01-15

class MelonApiException extends Exception

Exception thrown when the Melon API returns an error or invalid response.

Methods

__construct(string $message = '', int $code = 0, Throwable|null $previous = null)

Create a new MelonApiException instance

invalidResponse(string $expectedKey)

Create exception for invalid response structure

requestFailed(string $url, string $reason)

Create exception for HTTP request failure

jsonParseError(string $url, string $error)

Create exception for JSON parsing failure

emptyResponse(string $url)

Create exception for empty response.

Details

at line 21
__construct(string $message = '', int $code = 0, Throwable|null $previous = null)

Create a new MelonApiException instance

Parameters

string $message

The exception message

int $code

The exception code

Throwable|null $previous

The previous throwable

at line 29
static MelonApiException invalidResponse(string $expectedKey)

Create exception for invalid response structure

Parameters

string $expectedKey

Return Value

MelonApiException

at line 37
static MelonApiException requestFailed(string $url, string $reason)

Create exception for HTTP request failure

Parameters

string $url
string $reason

Return Value

MelonApiException

at line 45
static MelonApiException jsonParseError(string $url, string $error)

Create exception for JSON parsing failure

Parameters

string $url
string $error

Return Value

MelonApiException

at line 53
static MelonApiException emptyResponse(string $url)

Create exception for empty response.

Parameters

string $url

Return Value

MelonApiException