UNPKG

2.94 kBTypeScriptView Raw
1/*!
2 * Copyright (c) 2017-2018 by The Funfix Project Developers.
3 * Some rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 * Type alias for errors that can be thrown.
19 *
20 * Since in JavaScript any object can be thrown, the standard
21 * `Error` class (capital `E`) is not useful as a type in signatures,
22 * the needed type being effectively `any`, but we still need a type
23 * alias for documentation purposes.
24 *
25 * And since `any` represents an untyped object that bypasses the
26 * type system, Funfix is using `Object` for TypeScript and `mixed`
27 * for Flow to represent such throwables.
28 */
29export declare type Throwable = Error | Object;
30/**
31 * A composite error represents a list of errors that were caught
32 * while executing logic which delays re-throwing of errors.
33 */
34export declare class CompositeError extends Error {
35 private errorsRef;
36 constructor(errors: Array<Throwable>);
37 /**
38 * Returns the full list of caught errors.
39 */
40 errors(): Array<Throwable>;
41}
42/**
43 * A dummy error that can be used for testing purposes.
44 */
45export declare class DummyError extends Error {
46 constructor(message?: string);
47}
48/**
49 * Thrown by various accessor methods or partial functions to indicate
50 * that the element being requested does not exist.
51 */
52export declare class NoSuchElementError extends Error {
53 constructor(message?: string);
54}
55/**
56 * Error throw in class constructors by implementations that
57 * are sealed or final.
58 */
59export declare class IllegalInheritanceError extends Error {
60 constructor(message?: string);
61}
62/**
63 * Signals that a function has been invoked at an illegal
64 * or inappropriate time.
65 *
66 * In other words, environment or application is not in an
67 * appropriate state for the requested operation.
68 */
69export declare class IllegalStateError extends Error {
70 constructor(message?: string);
71}
72/**
73 * Signals that a function has been invoked with illegal
74 * arguments.
75 */
76export declare class IllegalArgumentError extends Error {
77 constructor(message?: string);
78}
79/**
80 * Signals that a function or a method is missing an implementation,
81 * which should be provided in the future.
82 */
83export declare class NotImplementedError extends Error {
84 constructor(message?: string);
85}
86/**
87 * Signals that completion of a procedure took longer than anticipated.
88 */
89export declare class TimeoutError extends Error {
90 constructor(message?: string);
91}