Difference between revisions of "Exception class"

From Catglobe Wiki
Jump to: navigation, search
Line 1: Line 1:
 
{{CGscriptClass_Template
 
{{CGscriptClass_Template
|Name=<nowiki>Exception</nowiki>
+
|Name=Exception
 
|Description=Represents an error object. This object can contain only non-user (system) thrown errors - the errors that not thrown by [[Exception Handling|throw expression]]
 
|Description=Represents an error object. This object can contain only non-user (system) thrown errors - the errors that not thrown by [[Exception Handling|throw expression]]
 
|Methods=
 
|Methods=
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
 
|Properties=
 
|Properties=
{{CGscriptProperties_Template|ReturnType=Exception|Name=<nowiki>InnerException</nowiki>|HasGetter=1|Description=<nowiki>Gets the Exception instance that caused the current exception.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=Exception|Name=InnerException|HasGetter=1|Description=Gets the Exception instance that caused the current exception.}}
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Message</nowiki>|HasGetter=1|Description=<nowiki>Gets a message that describes the current exception.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=string|Name=Message|HasGetter=1|Description=Gets a message that describes the current exception.}}
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>StackTrace</nowiki>|HasGetter=1|Description=<nowiki>Return the internal stack trace, useful when sending a bugreport to Catglobe.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=string|Name=StackTrace|HasGetter=1|Description=Return the internal stack trace, useful when sending a bugreport to Catglobe.}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
 
}}
 
}}
  
=== <span style="color:#DF8621;">'''See also'''</span>  ===
+
 
 +
=== '''See also''' ===
 +
 
 
*[[Exception Handling|Exception handling (error runtime handling)]].
 
*[[Exception Handling|Exception handling (error runtime handling)]].
  
=== <span style="color:#DF8621;">'''Examples'''</span>  ===
+
 
 +
=== '''Examples''' ===
 +
 
 
Type below script into the CGScript prompt to get its result:
 
Type below script into the CGScript prompt to get its result:
  
 
<source lang="javascript">
 
<source lang="javascript">
 
object e;
 
object e;
try {
+
try { s = n; }  
      s = n;
 
}  
 
 
catch(e) {
 
catch(e) {
    print("====e.ToString()======");
+
print("====e.ToString()======");
    print(e.ToString());
+
print(e.ToString());
    print("\n====e.Message======");
+
print("\n====e.Message======");
    print(e.Message);
+
print(e.Message);
    print("\n====e.StackTrace======");
+
print("\n====e.StackTrace======");
    print(e.StackTrace);
+
print(e.StackTrace);
 
}
 
}
 
</source>
 
</source>

Revision as of 12:16, 17 October 2013

Exception



Represents an error object. This object can contain only non-user (system) thrown errors - the errors that not thrown by throw expression


Methods

  • string ToString() - The string representation of the object.

Properties

  • Exception InnerException { get; } - Gets the Exception instance that caused the current exception.
  • string Message { get; } - Gets a message that describes the current exception.
  • string ObjectTypeName { get; } - The name of the type of object.
  • string StackTrace { get; } - Return the internal stack trace, useful when sending a bugreport to Catglobe.
  • TypeInformation TypeInformation { get; } - Get information about this class.


See also


Examples

Type below script into the CGScript prompt to get its result:

object e;
try { s = n; } 
catch(e) {
 print("====e.ToString()======");
 print(e.ToString());
 print("\n====e.Message======");
 print(e.Message);
 print("\n====e.StackTrace======");
 print(e.StackTrace);
}