final class RarException extends Exception (View source)

This class serves two purposes: it is the type of the exceptions thrown by the RAR extension functions and methods and it allows, through static methods to query and define the error behaviour of the extension, i.e., whether exceptions are thrown or only warnings are emitted.
The following error codes are used:

  • -1 - error outside UnRAR library
  • 11 - insufficient memory
  • 12 - bad data
  • 13 - bad archive
  • 14 - unknown format
  • 15 - file open error
  • 16 - file create error
  • 17 - file close error
  • 18 - read error
  • 19 - write error
  • 20 - buffer too small
  • 21 - unkown RAR error
  • 22 - password required but not given

Properties

protected $message

The error message

from  Exception
protected $code

The error code

from  Exception
protected $file

The filename where the error happened

from  Exception
protected $line

The line where the error happened

from  Exception

Methods

__construct(string $message = "", int $code = 0, null|Throwable $previous = null)

Construct the exception. Note: The message is NOT binary safe.

string
getMessage()

Gets the Exception message

int
getCode()

Gets the Exception code

string
getFile()

Gets the file in which the exception occurred

int
getLine()

Gets the line in which the exception occurred

array
getTrace()

Gets the stack trace

null|Throwable
getPrevious()

Returns previous Exception

string
getTraceAsString()

Gets the stack trace as a string

string
__toString()

String representation of the exception

void
__wakeup()

No description

static bool
isUsingExceptions()

Check whether error handling with exceptions is in use

static 
setUsingExceptions(bool $using_exceptions)

Activate and deactivate error handling with exceptions

Details

__construct(string $message = "", int $code = 0, null|Throwable $previous = null)

Construct the exception. Note: The message is NOT binary safe.

Parameters

string $message

[optional] The Exception message to throw.

int $code

[optional] The Exception code.

null|Throwable $previous

[optional] The previous throwable used for the exception chaining.

final string getMessage()

Gets the Exception message

Return Value

string

final int getCode()

Gets the Exception code

Return Value

int

Returns the exception code as integer in {\Exception} but possibly as other type in {\Exception} descendants (for example as string in {\PDOException}).

final string getFile()

Gets the file in which the exception occurred

Return Value

string

Returns the name of the file from which the object was thrown.

final int getLine()

Gets the line in which the exception occurred

Return Value

int

Returns the line number where the thrown object was instantiated.

final array getTrace()

Gets the stack trace

Return Value

array

Returns the stack trace as an array in the same format as {\debug_backtrace()}.

final null|Throwable getPrevious()

Returns previous Exception

Return Value

null|Throwable

Returns the previous {\Throwable} if available, or NULL otherwise.

final string getTraceAsString()

Gets the stack trace as a string

Return Value

string

Returns the stack trace as a string.

string __toString()

String representation of the exception

Return Value

string

Returns string representation of the object that implements this interface (and/or "__toString" magic method).

void __wakeup()

No description

Return Value

void

static bool isUsingExceptions()

Check whether error handling with exceptions is in use

Return Value

bool

TRUE if exceptions are being used, FALSE otherwise

static setUsingExceptions(bool $using_exceptions)

Activate and deactivate error handling with exceptions

Parameters

bool $using_exceptions

Should be TRUE to activate exception throwing, FALSE to deactivate (the default)