-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patherrors.ts
More file actions
89 lines (78 loc) · 2.4 KB
/
Copy patherrors.ts
File metadata and controls
89 lines (78 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* Error that is thrown when a class has a constructor with parameters. So you need to provide a factory
* method to actually instantiate the class and call the constructor by yourself.
*
* @export
* @class NoFactoryProvidedError
*/
export class NoFactoryProvidedError {
public message: string;
constructor(typeName: string) {
this.message = `The constructor of "${typeName}" is not parameterless, please provide a factory function.`;
}
}
/**
* Error hat is thrown when a type is duplicated. Either use the naming system or call it by another name ;-)
*
* @export
* @class DuplicateTypeRegistration
*/
export class DuplicateTypeRegistration {
public message: string;
constructor(typeName: string) {
this.message = `The type "${typeName}" is duplicated.`;
}
}
/**
* Error hat is thrown when function.name is not callable (when using in the browser or so). So you need to
* provide a name for the resolver system.
*
* @export
* @class NoNameProvided
*/
export class NoNameProvided {
public message: string;
constructor() {
this.message = `A type has no name provided, either function.name is not possible (ES5? IE?)` +
` or no name parameter was provided.`;
}
}
/**
* Error hat is thrown when a type that is beeing serialized or deserialized is not found in the resolver system.
* A possible cause could be that you forgot @Serializabe() on the type.
*
* @export
* @class TypeNotRegisteredError
*/
export class TypeNotRegisteredError {
public message: string;
constructor(obj: any) {
this.message = `The object "${obj}" is not found in the type registration. Did you forget the @Serializable` +
` decorator?`;
}
}
/**
* Error hat is thrown when a referenced object is not found.
*
* @export
* @class ReferenceObjectNotFoundError
*/
export class ReferenceObjectNotFoundError {
public message: string;
constructor() {
this.message = 'The reference object was not found in the previous deserialized objects';
}
}
/**
* Error that is thrown when an input to deserialize or serialize is undefined.
*
* @export
* @class UndefinedInputError
*/
export class UndefinedInputError {
public message: string;
constructor(functionname: string) {
this.message = `The input of your '${functionname}' call was undefined.
Undefined can't be serlialized or deserialized.`;
}
}