$errorCodes Canada Post's own codes from the error body (e.g. 9111). */ public function __construct( string $message, private readonly int $httpStatus = 0, private readonly array $errorCodes = array(), ) { parent::__construct( $message ); } public function httpStatus(): int { return $this->httpStatus; } /** @return list */ public function errorCodes(): array { return $this->errorCodes; } public function hasErrorCode( string $code ): bool { return in_array( $code, $this->errorCodes, true ); } }