Class: Exception

Exception

Exceptions represent unexpected errors or circumstances that may be caught. In Shiviz, you should ONLY ever throw Exception objects (as opposed to say, raw strings). Exceptions contain a message that can be retrieved in HTML form or as a raw string. The message can be either user-friendly or non-user-friendly. A user-friendly message is one that would make sense to a reasonable end-user who has no knowledge of Shiviz's internal workings.

Constructor

new Exception(message, isUserFriendly)

Constructs an Exception object that has the message specified.
Parameters:
Name Type Description
message String The message
isUserFriendly Boolean if true, this message is user-friendly
Source:

Methods

append(string, styleopt, nullable)

Appends text to the message contained in this object. The new text will be added after existing text
Parameters:
Name Type Attributes Description
string String The message text to append
style String <optional>
<nullable>
The text style. Should be one of 'bold', 'italic', or 'code'. This parameter should be omitted or set to null if normal, unstyled text is desired
Source:

getHTMLMessage() → {String}

Gets the message as HTML. This will be an escaped piece of HTML code that can be inserted into say, a div
Source:
Returns:
the exception message
Type
String

getMessage() → {String}

Gets the message contained as a raw string. The raw string ignored any text style specified when appending or prepending text
Source:
Returns:
the exception message
Type
String

isUserFriendly() → {Boolean}

Returns true if the message contained in this object is user-friendly. A user-friendly message is one that would make sense to a reasonable end-user who has knowledge of Shiviz's internal workings.
Source:
Returns:
true if user friendly
Type
Boolean

prepend(string, style)

Prepends text to the message contained in this object. The new text will be added before existing text
Parameters:
Name Type Description
string String The message text to prepend
style String The text style. Should be one of 'bold', 'italic', or 'code'. This parameter should be omitted if normal, unstyled text is desired
Source:

setUserFriendly(val)

Sets whether or not the message contained in this object is user-friendly. A user-friendly message is one that would make sense to a reasonable end-user who has no knowledge of Shiviz's internal workings.
Parameters:
Name Type Description
val Boolean true if this should be set to user-friendly
Source: