public function getException($message)
    {
        // make exception based on the status code
        switch ($this->statusCode) {
            case 400:
                return
                    $message?
                        new PlivoValidationException($message):
                        new PlivoValidationException(
                            "A parameter is missing or ".
                            "is invalid while accessing resource");
                break;
            case 401:
                return
                    $message?
                        new PlivoAuthenticationException($message):
                        new PlivoAuthenticationException(
                        "Failed to authenticate while accessing resource");
                break;
            case 404:
                return
                    $message?
                        new PlivoNotFoundException($message):
                        new PlivoNotFoundException(
                        "Failed to authenticate while accessing resource");
                break;
            case 405:
                return
                    $message?
                        new PlivoRequestException($message):
                        new PlivoRequestException(
                        "HTTP method used is not allowed to access resource");
                break;
            case 500:
                return
                    $message?
                        new PlivoServerException($message):
                        new PlivoServerException(
                        "A server error occurred while accessing resource");
                break;
            default:
                return new PlivoRestException(json_encode($this->responseData));
        }

    }
public function getException($message)
    {
        // make exception based on the status code
        switch ($this->statusCode) {
            case 400:
                return
                    $message?
                        new PlivoValidationException($message):
                        new PlivoValidationException(
                            "A parameter is missing or ".
                            "is invalid while accessing resource");
                break;
            case 401:
                return
                    $message?
                        new PlivoAuthenticationException($message):
                        new PlivoAuthenticationException(
                        "Failed to authenticate while accessing resource");
                break;
            case 404:
                return
                    $message?
                        new PlivoNotFoundException($message):
                        new PlivoNotFoundException(
                        "Failed to authenticate while accessing resource");
                break;
            case 405:
                return
                    $message?
                        new PlivoRequestException($message):
                        new PlivoRequestException(
                        "HTTP method used is not allowed to access resource");
                break;
            case 500:
                return
                    $message?
                        new PlivoServerException($message):
                        new PlivoServerException(
                        "A server error occurred while accessing resource");
                break;
            default:
                return new PlivoRestException(json_encode($this->responseData));
        }

    }
public function getException ( $ message ) { // make exception based on the status code switch ( $ this -> statusCode ) { case 400 : return $ message ? new PlivoValidationException ( $ message ) : new PlivoValidationException ( "A parameter is missing or " . "is invalid while accessing resource" ) ; break ; case 401 : return $ message ? new PlivoAuthenticationException ( $ message ) : new PlivoAuthenticationException ( "Failed to authenticate while accessing resource" ) ; break ; case 404 : return $ message ? new PlivoNotFoundException ( $ message ) : new PlivoNotFoundException ( "Failed to authenticate while accessing resource" ) ; break ; case 405 : return $ message ? new PlivoRequestException ( $ message ) : new PlivoRequestException ( "HTTP method used is not allowed to access resource" ) ; break ; case 500 : return $ message ? new PlivoServerException ( $ message ) : new PlivoServerException ( "A server error occurred while accessing resource" ) ; break ; default : return new PlivoRestException ( json_encode ( $ this -> responseData ) ) ; } }
Returns an exceptions with a message based on the status code
@param string $message
@return PlivoAuthenticationException|PlivoNotFoundException|PlivoRequestException|PlivoRestException|PlivoServerException|PlivoValidationException
Returns an exceptions with a message based on the status code