Added Canvas 1.1.0, originally not under SCM so no historical development records...
[canvas.git] / extensions / extexception.php
blobc1156fd580fbead389fab56ccb6ffe01f0054903
1 <?php
2 // @title Extension Exception class
3 // @author Matt Todd <matt@matttoddphoto.com>
4 // @created 2005-10-07
5 // @desc An Exception class specifically for 3rd party extensions (to be extended)
7 class ExtException extends Exception {
8 // private variables
9 public $nErrorCode;
10 public $strErrorMessage;
11 public $strErrorLocation;
12 public $strErrorContext;
13 public $aDump;
15 // constructor
16 public function __construct($nErrorCode = "0099", $strErrorMessage = "Undefined", $strErrorLocation = "", $strErrorContext = "", $aDump = "") {
17 $this->nErrorCode = $nErrorCode;
18 $this->strErrorMessage = $strErrorMessage;
19 $this->strErrorLocation = $strErrorLocation;
20 $this->strErrorContext = $strErrorContext;
21 $this->aDump = $aDump;
24 // functions
25 public function GetErrorCode() {
26 return $this->nErrorCode;
28 public function GetErrorMessage() {
29 return $this->strErrorMessage;
31 public function GetErrorLocation() {
32 return $this->strErrorLocation;
34 public function GetErrorContext() {
35 return $this->strErrorContext;
37 public function GetDump() {
38 return $this->aDump;
40 public function AsString($bHTML = false) {
41 if($bHTML) {
42 return "<strong>Error No. {$this->strErrorCode}</strong>: {$this->strErrorMessage} (<em>{$this->strErrorLocation}</em>)";
43 } else {
44 return "Error No. {$this->strErrorCode}: {$this->strErrorMessage} ({$this->strErrorLocation})";
48 // aliases
49 public function GetError() {
50 return "Error No. " . $this->GetErrorCode() . ": " . $this->GetErrorMessage();