Skip to content

error

Throw an error.

error(errMsg)
error(msgId, errMsg)
error(msgId, errMsg, v1, v2, ...)

Aborts execution and raises an error. The optional msgId (a string like 'MyComp:badInput') lets calling try/catch blocks discriminate among error sources. Variadic v1, v2, ... are formatted into the message via sprintf-style substitution.

error('Input must be positive')
error('MyApp:notFound', 'File %s not found', filename)
  • warning — Display a warning message.
  • assert — Assert that a condition is true; throw an error if not.
  • MException — Construct an exception object.
  • throw — Throw a previously-constructed exception.