Skip to content

Errors [v2]

Adrien Castex edited this page Jun 30, 2017 · 1 revision

The server manage two kinds of errors : Basic errors (of class Error) and errors of a serializer not found (of class SerializerNotFound).

Common errors

The module provides a list of common errors. When a common error is occurring, it uses the reference stored in the Errors constant. This way, it is possible to check if a common error occurred with the === operator :

resource.action((error) => {
    if(error === Errors.ResourceNotFound)
    {
        // The resource is not found
    }
    else if(error)
    {
        // Another error occured
    }

    // [...]
})

Here is the list of the common errors :

Name Text
BadAuthentication Bad authentication.
AuthenticationPropertyMissing Properties are missing.
WrongHeaderFormat Wrong header format.
MissingAuthorisationHeader Missing Authorization header.
UnrecognizedResource Unrecognized resource.
ParentPropertiesMissing The parent resource must have some special properties.
InvalidOperation Invalid operation.
ResourceAlreadyExists The resource already exists.
ResourceNotFound Can't find the resource.
CannotLockResource Can't lock the resource.
PropertyNotFound No property with such name.
AlreadyAuthenticated Already authenticated.
UserNotFound User not found.
XMLNotFound Can't find the XML element : {XML-name} [This error cannot be checked by reference]
ExpectedAFileResourceType Expected a file resource type.
NoMimeTypeForAFolder Cannot get the mime type of a folder type resource.
NoSizeForAFolder Cannot get the size of a folder type resource.
IllegalArguments Illegal arguments.
MustIgnore There was an error but it must not stop the processing.
Locked The resource is locked, operation forbidden.
InsufficientStorage Insufficient storage space.
IntermediateResourceMissing One or more intermediate resources are missing for this operation.
WrongParentTypeForCreation Cannot create a child resource to a non directory resource.
NotEnoughPrivilege Not enough privilege.
Forbidden Forbidden operation.

Serializer not found error

The 'Serializer not found error' is materialized by the SerializerNotFound class. It is used during unserialization to mark the difference between an execution error and a not found FileSystemSerializer.

Implementation

class SerializerNotFound extends Error
{
    constructor(public serializerUID : string)
    {
        super('Cannot find the serializer : ' + serializerUID);
    }
}
Clone this wiki locally