Difference between revisions of "Exception class"

From Catglobe Wiki
Jump to: navigation, search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{HelpFiles}}
 
 
{{CGscriptClass_Template
 
{{CGscriptClass_Template
 
|Name=<nowiki>Exception</nowiki>
 
|Name=<nowiki>Exception</nowiki>
 
|Description=<nowiki>Represents an error object.</nowiki>
 
|Description=<nowiki>Represents an error object.</nowiki>
|Methods=
+
|InheritsFrom=object|Methods=
 +
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>Returns a string representation of the current exception</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
 
|Properties=
 
|Properties=
Line 10: Line 10:
 
{{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=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{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=<nowiki>StackTrace</nowiki>|HasGetter=1|Description=<nowiki>Return the internal stack trace, useful when sending a bugreport to Catglobe.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
 
}}
 
}}
 +
 +
=== '''See also''' ===
 +
 +
*[[Exception Handling|Exception handling (error runtime handling)]].
 +
 +
 +
=== '''Examples''' ===
 +
 +
Type below script into the CGScript prompt to get its result:
 +
 +
<source lang="javascript">
 +
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);
 +
}
 +
</source>

Latest revision as of 09:03, 2 July 2020

Exception



Represents an error object.

Parent class

Inherits from object

Methods

  • string ToString() - Returns a string representation of the current exception
  • 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.
  • (From object) 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);
}