Exception

(PHP 5 >= 5.1.0)

Introduction

Exception is the base class for all Exceptions.

Class synopsis

Exception {
/* Properties */
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
/* Methods */
public __construct ([ string $message = "" [, int $code = 0 [, Exception $previous = NULL ]]] )
final public string getMessage ( void )
final public Exception getPrevious ( void )
final public mixed getCode ( void )
final public string getFile ( void )
final public int getLine ( void )
final public array getTrace ( void )
final public string getTraceAsString ( void )
public string __toString ( void )
final private void __clone ( void )
}

Properties

message

The exception message

code

The exception code

file

The filename where the exception was created

line

The line where the exception was created

Table of Contents

Коментарии

Автор:
Note that an exception's properties are populated when the exception is *created*, not when it is thrown.  Throwing the exception does not seem to modify them.

Among other things, this means:

* The exception will blame the line that created it, not the line that threw it.

* Unlike in some other languages, rethrowing an exception doesn't muck up the trace.

* A thrown exception and an unthrown one look basically identical.  On my machine, the only visible difference is that a thrown exception has an `xdebug_message` property while an unthrown one doesn't.  Of course, if you don't have xdebug installed, you won't even get that.
2014-09-27 21:34:51
http://php5.kiev.ua/manual/ru/class.exception.html
Lists of Throwable and Exception tree as of 7.2.0

    Error
      ArithmeticError
        DivisionByZeroError
      AssertionError
      ParseError
      TypeError
        ArgumentCountError
    Exception
      ClosedGeneratorException
      DOMException
      ErrorException
      IntlException
      LogicException
        BadFunctionCallException
          BadMethodCallException
        DomainException
        InvalidArgumentException
        LengthException
        OutOfRangeException
      PharException
      ReflectionException
      RuntimeException
        OutOfBoundsException
        OverflowException
        PDOException
        RangeException
        UnderflowException
        UnexpectedValueException
      SodiumException 

Find the script and output in the following links:
https://gist.github.com/mlocati/249f07b074a0de339d4d1ca980848e6a
https://3v4l.org/sDMsv

posted by someone here class.throwable
2018-01-28 09:55:56
http://php5.kiev.ua/manual/ru/class.exception.html
Note: this documentation not full, ReflectionObject::export($exception):
<?php
Object of 
class [  class Exception implements Throwable ] {
  - 
Properties [7] {
   
Property [  protected $message ]
   
Property [  private $string ]
   
Property [  protected $code ]
   
Property [  protected $file ]
   
Property [  protected $line ]
   
Property [  private $trace ]
   
Property [  private $previous ]
  }
  - 
Methods [11] {
   
Method [  final private method __clone ] {
    }

   
Method [  public method __construct ] {

      - 
Parameters [3] {
       
Parameter #0 [  $message ]
       
Parameter #1 [  $code ]
       
Parameter #2 [  $previous ]
     
}
    }

   
Method [  public method __wakeup ] {
    }

   
Method [  final public method getMessage ] {
    }

   
Method [  final public method getCode ] {
    }

   
Method [  final public method getFile ] {
    }

   
Method [  final public method getLine ] {
    }

   
Method [  final public method getTrace ] {
    }

   
Method [  final public method getPrevious ] {
    }

   
Method [  final public method getTraceAsString ] {
    }

   
Method [  public method __toString ] {
    }
  }
}
?>

Missed:

    Property [  private $string ]
    Property [  private $trace ]
    Property [  private $previous ]

    Method [  public method __wakeup ] {
    }
2020-02-20 04:11:59
http://php5.kiev.ua/manual/ru/class.exception.html

    Поддержать сайт на родительском проекте КГБ