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.
34 lines (33 loc) • 1.03 kB
TypeScript
/**
* Copyright (c) 2019 ABB Switzerland Ltd.
*/
/**
* Throws an error with the given name and message
* @param name error name, without timezonecomplete prefix
* @param format message with percent-style placeholders
* @param args arguments for the placeholders
* @throws the given error
*/
export declare function throwError(name: string, format: string, ...args: any[]): never;
/**
* Returns an error with the given name and message
* @param name
* @param format
* @param args
* @throws nothing
*/
export declare function error(name: string, format: string, ...args: any[]): 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;