src/Factory/ExceptionFactory.php
public static function create(ResponseInterface $response, \Exception $e): MoovlyException
    {
        try {
            $APIResponse = json_decode($response->getBody()->getContents(), true);
        } catch (\Exception $e) {
            $APIResponse = [];
        }

        $message = null;

        if (array_key_exists('message', $APIResponse)) {
            $message = $APIResponse['message'];
        }

        if (array_key_exists('error', $APIResponse)) {
            $message = $APIResponse['error'];
        }

        switch ($response->getStatusCode()) {
            case 400:
                return new BadRequestException($message);
            case 401:
            case 403:
                return new BadAuthorizationException();
            case 404:
                return new NotFoundException($message);
            default:
                return new MoovlyException('The API resulted in a faulty request', 400, $e);
        }
    }
public static function create(ResponseInterface $response, \Exception $e): MoovlyException
    {
        try {
            $APIResponse = json_decode($response->getBody()->getContents(), true);
        } catch (\Exception $e) {
            $APIResponse = [];
        }

        $message = null;

        if (array_key_exists('message', $APIResponse)) {
            $message = $APIResponse['message'];
        }

        if (array_key_exists('error', $APIResponse)) {
            $message = $APIResponse['error'];
        }

        switch ($response->getStatusCode()) {
            case 400:
                return new BadRequestException($message);
            case 401:
            case 403:
                return new BadAuthorizationException();
            case 404:
                return new NotFoundException($message);
            default:
                return new MoovlyException('The API resulted in a faulty request', 400, $e);
        }
    }
@param ResponseInterface $response

@return MoovlyException