Exception

(in ./Carbon/Exception.lua)

Signals detailed, strongly-typed error conditions.

Inherits OOP.Object


Methods

class public Exception:New(string message)

Returns Exception

class public Exception:PlacementNew(Exception? out, string message)

Returns Exception

object public Exception:Init(string message)

Returns void

  • required message: The message to initialize the exception with.

Creates a new generic exception with the given message.


object public Exception:Throw([uint level])

Returns void

  • optional level: An optional parameter passed onto Lua's error function.

Throws the exception as a traditional Lua error.


object public Exception:ThrowIf(bool condition, [uint level])

Returns void

  • required condition: The condition determining whether this exception should throw.
  • optional level: Passed onto Lua's error method determining the level of the error.

Throws the exception if a given condition is truthy. Similar to Lua's assert.


Properties

public string Exception.Message

An error message explaining the exception.