UNPKG

nani

Version:

Better error handling for Node

17 lines (16 loc) 760 B
/** * Returns the full name of an Error instance or constructor. * * @remarks * If no fullName property is found, this function attempts to determine one * based on the name property. If the name is simply 'Error', then so too is the * fullName. If the name ends with 'Error', then the fullName will be the name * appended to 'Error', separated by a dot. This enables some support for error * classes that are not subclasses of NaniError, by assuming they're at least * instances of Error. * * @param err - An Error instance or constructor. If omitted or falsy, this * function will return null. * @returns Full name if it can be determined, null otherwise. */ export declare function getFullName(err?: Error | Function | null): string | null;