UNPKG

1.53 kBTypeScriptView Raw
1/**
2 * A runtime option indicating whether the build has debugging enabled.
3 */
4export let debug: boolean;
5
6/**
7 * A class encapsulating information for source code origin.
8 */
9export class Source {
10 /**
11 * Creates a new Source instance by given uri, line and column.
12 */
13 constructor(uri: string, line: number, column: number);
14
15 /**
16 * Gets the URI of the source document;
17 */
18 uri: string;
19
20 /**
21 * Gets the line in the source document.
22 */
23 line: number;
24
25 /**
26 * Gets the position in the source document.
27 */
28 column: number;
29
30 /**
31 * Get the source of an object.
32 */
33 public static get(object: any): Source;
34
35 /**
36 * Set the source of an object.
37 */
38 public static set(object: any, src: Source);
39}
40
41/**
42 * An Error class that provides additional context to an error.
43 */
44export class ScopeError extends Error {
45 /**
46 * Creates a new ScopeError providing addtional context to the child error.
47 * @param child The child error to extend.
48 * @param message Additional message to prepend to the child error.
49 */
50 constructor(child: Error, message?: string);
51}
52
53/**
54 * Represents a scope error providing addiot
55 */
56export class SourceError extends ScopeError {
57 /**
58 * Creates a new SourceError by child error, source and optional message.
59 * @param child The child error to extend.
60 * @param source The source where the error occured.
61 * @param message Additonal message to prepend along the source location and the child error's message.
62 */
63 constructor(child: Error, source: Source, message?: string);
64}