message; if($this->code!=0) $err= get_class($this). " '{$this->message}' in {$this->file}({$this->line})\n". "{$this->getTraceAsString()}"; return $err; } } class DbErrException extends CustomException{}; class DbResException extends DbErrException{}; class UsageException extends CustomException{ public function __construct($message = null, $code = 0) { if (!$message and $code == 0) { throw new $this('Unknown '. get_class($this)); } elseif ($message != null and $code > 0) { $argv="Err: ".$message."\n"; $message="Bad arg: ".$argv." is not a valid command, with ".$code." arguments\n"; $code=0; } parent::__construct($message, $code); } public function __toString() { return $this->message; } } class OtConfException extends CustomException{}; class FileException extends CustomException{ public function __toString() { return $this->message; } }; ?>