UNPKG

timezonecomplete

Version:

DateTime, TimeZone, Duration and Period library aimed at providing a consistent and complete date-time interface, away from the original JavaScript Date class.

33 lines (32 loc) 967 B
/** * Copyright (c) 2019 ABB Switzerland Ltd. */ /** * Throws an error with the given name and message * @param name error name, without timezonecomplete prefix * @param message complete message * @param args arguments for the placeholders * @throws the given error */ export declare function throwError(name: string, message: string): never; /** * Returns an error with the given name and message * @param name * @param message * @throws nothing */ export declare function error(name: string, message: string): Error; /** * Returns true iff `error.name` is equal to or included by `name` * @param error * @param name string or array of strings * @throws nothing */ export declare function errorIs(error: Error, name: string | string[]): boolean; /** * Converts all errors thrown by `cb` to the given error name * @param errorName * @param cb * @throws [errorName] */ export declare function convertError<T>(errorName: string, cb: () => T): T;