Skip to content

Commit

Permalink
Added some standard errors to the 'Errors' bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 26, 2017
1 parent b49c35a commit 37afaaa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
6 changes: 6 additions & 0 deletions lib/Errors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export declare class HTTPError extends Error {
export declare const Errors: {
BadAuthentication: Error;
AuenticationPropertyMissing: Error;
AuthenticationPropertyMissing: Error;
WrongHeaderFormat: Error;
MissingAuthorisationHeader: Error;
UnrecognizedResource: Error;
Expand All @@ -27,6 +28,11 @@ export declare const Errors: {
NoSizeForAFolder: Error;
IllegalArguments: Error;
MustIgnore: Error;
SerializerNotFound: Error;
Locked: Error;
InsufficientStorage: Error;
IntermediateResourceMissing: Error;
WrongParentTypeForCreation: Error;
None: any;
};
export default Errors;
11 changes: 9 additions & 2 deletions lib/Errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ var HTTPError = (function (_super) {
return HTTPError;
}(Error));
exports.HTTPError = HTTPError;
var AuthenticationPropertyMissing = new Error('Properties are missing.');
exports.Errors = {
BadAuthentication: new Error('Bad authentication.'),
AuenticationPropertyMissing: new Error('Properties are missing.'),
AuenticationPropertyMissing: AuthenticationPropertyMissing,
AuthenticationPropertyMissing: AuthenticationPropertyMissing,
WrongHeaderFormat: new Error('Wrong header format.'),
MissingAuthorisationHeader: new Error('Missing Authorization header.'),
UnrecognizedResource: new Error('Unrecognized resource.'),
Expand All @@ -45,12 +47,17 @@ exports.Errors = {
PropertyNotFound: new Error('No property with such name.'),
AlreadyAuthenticated: new Error('Already authenticated.'),
UserNotFound: new Error('User not found.'),
XMLNotFound: new Error('Can\'t find the XML element.'),
XMLNotFound: new Error('Can\'t find the XML element : '),
ExpectedAFileResourceType: new Error('Expected a file resource type.'),
NoMimeTypeForAFolder: new Error('Cannot get the mime type of a folder type resource.'),
NoSizeForAFolder: new Error('Cannot get the size of a folder type resource.'),
IllegalArguments: new Error('Illegal arguments.'),
MustIgnore: new Error('There was an error but it must not stop the processing.'),
SerializerNotFound: new Error('One serializer could not be found.'),
Locked: new Error('The resource is locked, operation forbidden.'),
InsufficientStorage: new Error('Insufficient storage space.'),
IntermediateResourceMissing: new Error('One or more intermediate resources are missing for this operation.'),
WrongParentTypeForCreation: new Error('Cannot create a child resource to a non directory resource.'),
None: null
};
exports.default = exports.Errors;
12 changes: 10 additions & 2 deletions src/Errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export class HTTPError extends Error
}
}

const AuthenticationPropertyMissing = new Error('Properties are missing.');

export const Errors = {
BadAuthentication: new Error('Bad authentication.'),
AuenticationPropertyMissing: new Error('Properties are missing.'),
AuenticationPropertyMissing: AuthenticationPropertyMissing, // Bad synthax
AuthenticationPropertyMissing,
WrongHeaderFormat: new Error('Wrong header format.'),
MissingAuthorisationHeader: new Error('Missing Authorization header.'),
UnrecognizedResource: new Error('Unrecognized resource.'),
Expand All @@ -29,12 +32,17 @@ export const Errors = {
PropertyNotFound: new Error('No property with such name.'),
AlreadyAuthenticated: new Error('Already authenticated.'),
UserNotFound: new Error('User not found.'),
XMLNotFound: new Error('Can\'t find the XML element.'),
XMLNotFound: new Error('Can\'t find the XML element : '),
ExpectedAFileResourceType: new Error('Expected a file resource type.'),
NoMimeTypeForAFolder: new Error('Cannot get the mime type of a folder type resource.'),
NoSizeForAFolder: new Error('Cannot get the size of a folder type resource.'),
IllegalArguments: new Error('Illegal arguments.'),
MustIgnore: new Error('There was an error but it must not stop the processing.'),
SerializerNotFound: new Error('One serializer could not be found.'),
Locked: new Error('The resource is locked, operation forbidden.'),
InsufficientStorage: new Error('Insufficient storage space.'),
IntermediateResourceMissing: new Error('One or more intermediate resources are missing for this operation.'),
WrongParentTypeForCreation: new Error('Cannot create a child resource to a non directory resource.'),

None: null
};
Expand Down

0 comments on commit 37afaaa

Please sign in to comment.