* @license MIT License * @version GIT: * @link https://git.keithsolomon.net/keith/Spacetraders */ /** * Custom exception class for Spacetraders API related errors. * * @extends RuntimeException */ class SpacetradersApiException extends RuntimeException { /** * Error payload data from the API response. * * @var array */ protected array $errorPayload = array(); /** * Constructor for SpacetradersApiException. * * @param string $message The exception message. * @param int $code The exception code (default: 0). * @param array $errorPayload The error payload from API response (default: empty array). */ public function __construct( string $message, int $code = 0, array $errorPayload = array() ) { parent::__construct( $message, $code ); $this->errorPayload = $errorPayload; } /** * Get the error payload from the API response. * * @return array */ public function getErrorPayload(): array { return $this->errorPayload; } }