get name()

The `get` accessor obtains error object name

Error.prototype.name

Error name of a string type, set to 'Error' that is being thrown.

error.class.ts
public get name(): string {
  return 'Error';
}

Return type

Returns

The return value is the error instance name of string type.

Example usage

// Example usage.
import { Error } from '@angular-package/error';

// Returns "Error".
new Error('Wrong type', 'Change the type', 'TE:201').name;

Last updated