PHPCap API

PhpCapException extends Exception
in package

Exception class for PHPCap exceptions. This is the exception that PHPCap will throw when it encounters an error.

Example usage:


try {
    $projectInfo = $project->exportProjectInfo();
}
catch (PhpCapException $exception) {
    print "The following error occurred: {$exception->getMessage()}\n";
    print "Error code: {$exception->getCode()}\n";
    $connectionErrorNumber = $exception->getConnectionErrorNumber();
    if (isset($connectionErrorNumber)) {
        print "A connection error occurred.\n";
        print "Connection error number: {$connectionErrorNumber}\n";
    }
    print "Stack trace:\n{$exception->getTraceAsString()}\n";
}

Tags
see
http://php.net/manual/en/class.exception.php

Information on additional methods provided by parent class Exception.

Table of Contents

__construct()  : mixed
Constructor.
getConnectionErrorNumber()  : int|null
Returns the connection error number, or null if there was no connection error. The possible numbers returned will depend on the type of connection class being used. For example, if cURL is being used, then the cURL error number would be returned.
getHttpStatusCode()  : int|null
Returns the HTTP status code, or null if this was not set.

Methods

__construct()

Constructor.

public __construct(string $message, int $code[, int $connectionErrorNumber = null ][, int $httpStatusCode = null ][, Exception $previous = null ]) : mixed
Parameters
$message : string

the error message.

$code : int

the error code.

$connectionErrorNumber : int = null

the connection error number (set to null if no connection error occurred).

$httpStatusCode : int = null

the HTTP status code (set to null if no HTTP status code was returned).

$previous : Exception = null

the previous exception.

Return values
mixed

getConnectionErrorNumber()

Returns the connection error number, or null if there was no connection error. The possible numbers returned will depend on the type of connection class being used. For example, if cURL is being used, then the cURL error number would be returned.

public getConnectionErrorNumber() : int|null
Return values
int|null

connection error number, or null if there was no connection error.

getHttpStatusCode()

Returns the HTTP status code, or null if this was not set.

public getHttpStatusCode() : int|null
Return values
int|null

HTTP status code, or null if this was not set.

Search results