-
Notifications
You must be signed in to change notification settings - Fork 3
/
errors.coffee
96 lines (64 loc) · 2.22 KB
/
errors.coffee
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
90
91
92
93
94
95
96
define ->
###
Custom exception classes used in the framework's core
###
isInternal: isInternal = (err) ->
err.isCordInternal or err.message?.match /Chunk error.*(WidgetSentenced|WidgetParamsRace)/
getType: getType = (err) ->
if isInternal(err) then 'internal' else (err.type or 'error')
CordError: class CordError extends Error
###
Base error class
###
name: 'CordError'
type: 'error'
message: ''
isCordInternal: false
constructor: (message, type) ->
@message = message
@isCordInternal = isInternal(@)
if type
@type = type
else if @isCordInternal
@type = 'internal'
Error.call(this, message)
Error.captureStackTrace?(this, arguments.callee)
TranslatedError: class TranslatedError extends CordError
name: 'TranslatedError'
WidgetDropped: class WidgetDropped extends CordError
name: 'WidgetDropped'
isCordInternal: true
WidgetSentenced: class WidgetSentenced extends CordError
name: 'WidgetSentenced'
isCordInternal: true
BehaviourCleaned: class BehaviourCleaned extends CordError
name: 'BehaviourCleaned'
isCordInternal: true
WidgetParamsRace: class WidgetParamsRace extends CordError
name: 'WidgetParamsRace'
isCordInternal: true
MustReloadPage: class MustReloadPage extends CordError
name: 'MustReloadPage'
isCordInternal: true
MegaIdAuthFailed: class MegaIdAuthFailed extends CordError
name: 'MegaIdAuthFailed'
AuthError: class AuthError extends CordError
name: 'AuthError'
AutoAuthError: class AutoAuthError extends CordError
name: 'AutoAuthError'
ConfigError: class ConfigError extends CordError
name: 'ConfigError'
MustTransitPage: class MustTransitPage extends CordError
###
This error should be thrown to force transition to specified page
###
name: 'MustTransitPage'
constructor: (@widget, @params) ->
super("Transition to #{@widget} required!")
ItemNotFound: class ItemNotFound extends CordError
###
This class of errors throws when some registry can not found some element by name
###
name: 'ItemNotFound'
ValidationError: class ValidationError extends TranslatedError
name: 'ValidationError'