定義済みの例外
PHP Manual

ErrorException

導入

エラー例外です。

クラス概要

ErrorException
ErrorException extends Exception {
/* プロパティ */
protected int $severity ;
/* メソッド */
public ErrorException::__construct ([ string $message [, int $code [, int $severity [, string $filename [, int $lineno ]]]]] )
final public int ErrorException::getSeverity ( void )
/* 継承したメソッド */
final public string Exception::getMessage ( void )
final public int Exception::getCode ( void )
final public string Exception::getFile ( void )
final public string Exception::getLine ( void )
final public array Exception::getTrace ( void )
final public string Exception::getTraceAsString ( void )
public string Exception::__toString ( void )
final private string Exception::__clone ( void )
}

プロパティ

severity

例外の深刻度

例1 すべてのエラーメッセージを ErrorException に変換する

<?php
function exception_error_handler($errno$errstr$errfile$errline ) {
throw new 
ErrorException($errstr0$errno$errfile$errline);
}
set_error_handler("exception_error_handler");

/* 例外を発生させます */
strpos();
?>

上の例の出力は、たとえば 以下のようになります。

Fatal error: Uncaught exception 'ErrorException' with message 'Wrong parameter count for strpos()' in /home/bjori/tmp/ex.php:8
Stack trace:
#0 [internal function]: exception_error_handler(2, 'Wrong parameter...', '/home/bjori/php...', 8, Array)
#1 /home/bjori/php/cleandocs/test.php(8): strpos()
#2 {main}
  thrown in /home/bjori/tmp/ex.php on line 8

目次


定義済みの例外
PHP Manual
[お役立ちリンク集] NPO法人の設立(東京・大阪) 人材派遣・アルバイト 不動産・賃貸・マンション ハイブリッド派遣 堺市の入院・内科 京都市のインプラント 会社設立 産業廃棄物収集運搬業許可 風俗営業許可(バー・キャバクラ等) ディレクトリ1 | ディレクトリ2 | ディレクトリ3 | ディレクトリ4 | ディレクトリ5 | ディレクトリ6 | ディレクトリ7 | ディレクトリ8 | ディレクトリ9 | ディレクトリ10 | ディレクトリ11 | ディレクトリ12 | ディレクトリ13 | ディレクトリ14 | ディレクトリ15 | ディレクトリ16 | ディレクトリ17 | ディレクトリ18 | ディレクトリ19 | ディレクトリ20 | ディレクトリ21 | ディレクトリ22 | ディレクトリ23 | ディレクトリ24 | ディレクトリ25 | ディレクトリ26 | ディレクトリ27 | ディレクトリ28 | ディレクトリ29 | ディレクトリ30 | ディレクトリ31 | ディレクトリ32 | ディレクトリ33 | ディレクトリ34 | ディレクトリ35 | 人材派遣・アルバイト | 人材派遣・アルバイト | ディレクトリ36 |