C

Exception

Extension of the native JavaScript Error type that includes a stack trace.
Inheritance Hierarchy

Remarks

yFiles includes the following specialized exception types indicated by the name:

  • ArgumentError – Indicates that the value of a parameter of the current method is illegal.
  • ArgumentNullError – Indicates that the value of a parameter of the current method is null but a non-null value was expected.
  • ArgumentOutOfRangeError – Indicates that the value of a parameter of the current method is not in the legal range of values.
  • IndexOutOfRangeError – Indicates that an array index is not in the legal range.
  • NullReferenceError – Indicates that a value is null when it shouldn't.
  • InvalidOperationError – Indicates that the current operation is not valid in the instances's current state.
  • NotImplementedError – Indicates that the called method is not implemented.
  • NotSupportedError – Indicates that the operation is not supported.
  • ArithmeticError – Indicates an error in an arithmetic operation.
  • IOError – Indicates an error during an IO operation.
  • KeyNotFoundError – Indicates that a mapping does not contain the given key.
  • AlgorithmAbortedError – Indicates that an immediate termination request was detected by an algorithm.
  • InvalidGraphStructureError – Indicates that a graph cannot be used with a certain algorithm. Some graph algorithms require a specific graph structure, for example trees or planar graph. These algorithms throw this error if a non-matching graph is used.

This type also provides the static catchErrors property, which when enabled, causes most entry points (e.g. event listeners) to use try/catch blocks to catch possible errors that could be thrown during event handling. The errors are handled by the handleError function, which calls the handler function, if it has been set. Note that for some browsers/plugins, try/catch blocks prevent error debugging functionality. Hence, catchErrors should be turned off while debugging.

Members

No filters for this type

Constructors

Creates a new exception with the given message and an optional error name.

Parameters

message?: string
The exception message.
name?: string
The exception name. This name can be used in try...catch statements to distinguish between different types of errors.
cause?: Exception
The inner exception, if another exception was wrapped.

See Also

API
message

Properties

Gets the exception message.
readonlyfinal
Gets the exception name.
readonlyfinal

Constants

Whether to use try/catch blocks when invoking event handlers.
If this property is enabled, try/catch blocks are used when invoking event handlers. As most browsers provide a stack trace with Error objects, this property can be used to provide more detailed error information. If this property is set, but no handler is registered, a warning will be logged to the console instead.
static
If catchErrors is enabled, any caught errors are passed to this function.
Setting a handler via this property automatically turns on the catchErrors flag!
static

Static Methods

This function is called in catch blocks in the library if catchErrors is enabled.
If a handler is registered, the error is passed to the error handler, otherwise if catchErrors is set to true the error is logged to the console using console.warn if available.
static

Parameters

error: any
The error object that has been caught