-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
157 lines (138 loc) · 4.18 KB
/
index.js
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
class ExtendableError extends Error {
constructor(msg) {
super(msg)
this.name = this.constructor.name
this.message = msg
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor)
} else {
this.stack = (new Error(msg)).stack
}
}
}
exports.NotFoundError = class NotFoundError extends ExtendableError {
constructor(msg) {
super(msg || 'File not found')
this.notFound = true
}
}
exports.NotAFileError = class NotAFileError extends ExtendableError {
constructor(msg) {
super(msg || 'Target must be a file')
this.notAFile = true
}
}
exports.NotAFolderError = class NotAFolderError extends ExtendableError {
constructor(msg) {
super(msg || 'Target must be a folder')
this.notAFolder = true
}
}
exports.InvalidEncodingError = class InvalidEncodingError extends ExtendableError {
constructor(msg) {
super(msg || 'Invalid encoding')
this.invalidEncoding = true
}
}
exports.TimeoutError = class TimeoutError extends ExtendableError {
constructor(msg) {
super(msg || 'Timed out')
this.timedOut = true
}
}
exports.ArchiveNotWritableError = class ArchiveNotWritableError extends ExtendableError {
constructor(msg) {
super(msg || 'Cannot write to this archive ; Not the owner')
this.archiveNotWritable = true
}
}
exports.EntryAlreadyExistsError = class EntryAlreadyExistsError extends ExtendableError {
constructor(msg) {
super(msg || 'A file or folder already exists at this path')
this.entryAlreadyExists = true
}
}
exports.ParentFolderDoesntExistError = class ParentFolderDoesntExistError extends ExtendableError {
constructor(msg) {
super(msg || 'Cannot write to this location ; No parent folder exists')
this.parentFolderDoesntExist = true
}
}
exports.InvalidPathError = class InvalidPathError extends ExtendableError {
constructor(msg) {
super(msg || 'The given path is not valid')
this.invalidPath = true
}
}
exports.SourceNotFoundError = class SourceNotFoundError extends ExtendableError {
constructor(msg) {
super(msg || 'Cannot read a file or folder at the given source path')
this.sourceNotFound = true
}
}
exports.DestDirectoryNotEmpty = class DestDirectoryNotEmpty extends ExtendableError {
constructor(msg) {
super(msg || 'Destination path is not empty ; Aborting')
this.destDirectoryNotEmpty = true
}
}
exports.ProtocolSetupError = class ProtocolSetupError extends ExtendableError {
constructor(msg) {
super(msg || 'Error setting up the URL protocol')
this.protocolSetupError = true
}
}
exports.UserDeniedError = class UserDeniedError extends ExtendableError {
constructor(msg) {
super(msg || 'User denied permission')
this.permissionDenied = true
}
}
exports.PermissionsError = class PermissionsError extends ExtendableError {
constructor(msg) {
super(msg || 'Permissions denied')
this.permissionDenied = true
}
}
exports.QuotaExceededError = class QuotaExceededError extends ExtendableError {
constructor(msg) {
super(msg || 'Disk space quota exceeded')
this.quotaExceeded = true
}
}
exports.SourceTooLargeError = class SourceTooLargeError extends ExtendableError {
constructor(msg) {
super(msg || 'The source file is too large')
this.sourceTooLarge = true
}
}
exports.InvalidURLError = class InvalidURLError extends ExtendableError {
constructor(msg) {
super(msg || 'Invalid URL')
this.invalidUrl = true
}
}
exports.InvalidArchiveKeyError = class InvalidArchiveKeyError extends ExtendableError {
constructor(msg) {
super(msg || 'Invalid archive key')
this.invalidArchiveKey = true
}
}
exports.InvalidDomainName = class InvalidDomainName extends ExtendableError {
constructor(msg) {
super(msg || 'Invalid domain name')
this.invalidDomainName = true
}
}
exports.ProtectedFileNotWritableError = class ProtectedFileNotWritableError extends ExtendableError {
constructor(msg) {
super(msg || 'Protected file is not wrtable')
this.protectedFileNotWritable = true
}
}
exports.ModalActiveError = class ModalActiveError extends ExtendableError {
constructor(msg) {
super(msg || 'Modal already active')
this.modalActive = true
}
}