File tree Expand file tree Collapse file tree 11 files changed +25
-16
lines changed Expand file tree Collapse file tree 11 files changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ export declare const Errors: {
22
22
UserNotFound : Error ;
23
23
XMLNotFound : Error ;
24
24
ExpectedAFileResourceType : Error ;
25
+ NoMimeTypeForAFolder : Error ;
26
+ NoSizeForAFolder : Error ;
27
+ IllegalArguments : Error ;
25
28
None : any ;
26
29
} ;
27
30
export default Errors ;
Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ exports.Errors = {
45
45
UserNotFound : new Error ( 'User not found' ) ,
46
46
XMLNotFound : new Error ( 'Can\'t find the XML element.' ) ,
47
47
ExpectedAFileResourceType : new Error ( 'Expected a file resource type.' ) ,
48
+ NoMimeTypeForAFolder : new Error ( 'Cannot get the mime type of a folder type resource' ) ,
49
+ NoSizeForAFolder : new Error ( 'Cannot get the size of a folder type resource' ) ,
50
+ IllegalArguments : new Error ( 'Illegal arguments' ) ,
48
51
None : null
49
52
} ;
50
53
exports . default = exports . Errors ;
Original file line number Diff line number Diff line change @@ -75,10 +75,10 @@ var PhysicalFolder = (function (_super) {
75
75
callback ( Errors_1 . Errors . InvalidOperation , null ) ;
76
76
} ;
77
77
PhysicalFolder . prototype . mimeType = function ( targetSource , callback ) {
78
- callback ( new Error ( 'Cannot get the mime type of a folder type resource' ) , null ) ;
78
+ callback ( Errors_1 . Errors . NoMimeTypeForAFolder , null ) ;
79
79
} ;
80
80
PhysicalFolder . prototype . size = function ( targetSource , callback ) {
81
- callback ( new Error ( 'Cannot get the size of a folder type resource' ) , null ) ;
81
+ callback ( Errors_1 . Errors . NoSizeForAFolder , null ) ;
82
82
} ;
83
83
PhysicalFolder . prototype . addChild = function ( resource , callback ) {
84
84
var _this = this ;
Original file line number Diff line number Diff line change @@ -31,10 +31,10 @@ var VirtualFolder = (function (_super) {
31
31
callback ( Errors_1 . Errors . InvalidOperation , null ) ;
32
32
} ;
33
33
VirtualFolder . prototype . mimeType = function ( targetSource , callback ) {
34
- callback ( new Error ( 'Cannot get the mime type of a folder type resource' ) , null ) ;
34
+ callback ( Errors_1 . Errors . NoMimeTypeForAFolder , null ) ;
35
35
} ;
36
36
VirtualFolder . prototype . size = function ( targetSource , callback ) {
37
- callback ( new Error ( 'Cannot get the size of a folder type resource' ) , null ) ;
37
+ callback ( Errors_1 . Errors . NoSizeForAFolder , null ) ;
38
38
} ;
39
39
VirtualFolder . prototype . addChild = function ( resource , callback ) {
40
40
var _this = this ;
Original file line number Diff line number Diff line change @@ -31,10 +31,10 @@ var VirtualStoredFolder = (function (_super) {
31
31
callback ( Errors_1 . Errors . InvalidOperation , null ) ;
32
32
} ;
33
33
VirtualStoredFolder . prototype . mimeType = function ( targetSource , callback ) {
34
- callback ( new Error ( 'Cannot get the mime type of a folder type resource' ) , null ) ;
34
+ callback ( Errors_1 . Errors . NoMimeTypeForAFolder , null ) ;
35
35
} ;
36
36
VirtualStoredFolder . prototype . size = function ( targetSource , callback ) {
37
- callback ( new Error ( 'Cannot get the size of a folder type resource' ) , null ) ;
37
+ callback ( Errors_1 . Errors . NoSizeForAFolder , null ) ;
38
38
} ;
39
39
VirtualStoredFolder . prototype . addChild = function ( resource , callback ) {
40
40
var _this = this ;
Original file line number Diff line number Diff line change @@ -159,14 +159,14 @@ var WebDAVServer = (function () {
159
159
if ( callback instanceof Function )
160
160
_callback = callback ;
161
161
else
162
- throw new Error ( 'Illegal arguments' ) ;
162
+ throw Errors_1 . Errors . IllegalArguments ;
163
163
}
164
164
}
165
165
else if ( port && port . constructor === Function ) {
166
166
_port = this . options . port ;
167
167
_callback = port ;
168
168
if ( callback )
169
- throw new Error ( 'Illegal arguments' ) ;
169
+ throw Errors_1 . Errors . IllegalArguments ;
170
170
}
171
171
if ( ! this . server ) {
172
172
this . server = http . createServer ( function ( req , res ) {
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ export const Errors = {
31
31
UserNotFound : new Error ( 'User not found' ) ,
32
32
XMLNotFound : new Error ( 'Can\'t find the XML element.' ) ,
33
33
ExpectedAFileResourceType : new Error ( 'Expected a file resource type.' ) ,
34
+ NoMimeTypeForAFolder : new Error ( 'Cannot get the mime type of a folder type resource' ) ,
35
+ NoSizeForAFolder : new Error ( 'Cannot get the size of a folder type resource' ) ,
36
+ IllegalArguments : new Error ( 'Illegal arguments' ) ,
34
37
35
38
None : null
36
39
} ;
Original file line number Diff line number Diff line change @@ -92,11 +92,11 @@ export class PhysicalFolder extends PhysicalResource
92
92
}
93
93
mimeType ( targetSource : boolean , callback : ReturnCallback < string > )
94
94
{
95
- callback ( new Error ( 'Cannot get the mime type of a folder type resource' ) , null ) ;
95
+ callback ( Errors . NoMimeTypeForAFolder , null ) ;
96
96
}
97
97
size ( targetSource : boolean , callback : ReturnCallback < number > )
98
98
{
99
- callback ( new Error ( 'Cannot get the size of a folder type resource' ) , null ) ;
99
+ callback ( Errors . NoSizeForAFolder , null ) ;
100
100
}
101
101
102
102
// ****************************** Children ****************************** //
Original file line number Diff line number Diff line change @@ -34,11 +34,11 @@ export class VirtualFolder extends VirtualResource
34
34
}
35
35
mimeType ( targetSource : boolean , callback : ReturnCallback < string > )
36
36
{
37
- callback ( new Error ( 'Cannot get the mime type of a folder type resource' ) , null ) ;
37
+ callback ( Errors . NoMimeTypeForAFolder , null ) ;
38
38
}
39
39
size ( targetSource : boolean , callback : ReturnCallback < number > )
40
40
{
41
- callback ( new Error ( 'Cannot get the size of a folder type resource' ) , null ) ;
41
+ callback ( Errors . NoSizeForAFolder , null ) ;
42
42
}
43
43
44
44
// ****************************** Children ****************************** //
Original file line number Diff line number Diff line change @@ -34,11 +34,11 @@ export class VirtualStoredFolder extends VirtualStoredResource
34
34
}
35
35
mimeType ( targetSource : boolean , callback : ReturnCallback < string > )
36
36
{
37
- callback ( new Error ( 'Cannot get the mime type of a folder type resource' ) , null ) ;
37
+ callback ( Errors . NoMimeTypeForAFolder , null ) ;
38
38
}
39
39
size ( targetSource : boolean , callback : ReturnCallback < number > )
40
40
{
41
- callback ( new Error ( 'Cannot get the size of a folder type resource' ) , null ) ;
41
+ callback ( Errors . NoSizeForAFolder , null ) ;
42
42
}
43
43
44
44
// ****************************** Children ****************************** //
You can’t perform that action at this time.
0 commit comments