UNPKG

diffusion

Version:

Diffusion JavaScript client

69 lines (55 loc) 2.83 kB
var ErrorReason = require('../node_modules/client/error-reason'); /** * Enum containing reason codes used to report error conditions. * <p> * Some common ErrorReason values are defined as global constants. More specific reasons may be defined by * individual features. * * @example * // Handle an error from the server * session.subscribe('foo').on('error', function(e) { * if (e == diffusion.errors.ACCESS_DENIED) { * // Handle authorisation error * } else { * // Log the problem * console.log(e); * } * }); * * * @readonly * @enum * @alias diffusion.errors */ module.exports = { /** Communication with the server failed. */ COMMUNICATION_FAILURE : new ErrorReason(100, "Communication with server failed"), /** Communication with the server failed because the session is closed. */ SESSION_CLOSED : new ErrorReason(101, "Session is closed"), /** Communication with the server failed because a service request timed out. */ REQUEST_TIME_OUT : new ErrorReason(102, "Request time out"), /** The request was rejected because the caller has insufficient permissions. */ ACCESS_DENIED : new ErrorReason(103, "Access denied"), /** The request was rejected because the requested operation is unsupported for this caller. */ UNSUPPORTED : new ErrorReason(104, "Unsupported service"), /** An application callback threw an exception. Check logs for more information. */ CALLBACK_EXCEPTION : new ErrorReason(105, "An application callback threw an exception. Check logs for more information"), /** An operation failed because invalid data was received. */ INVALID_DATA : new ErrorReason(106, "Invalid data"), /** An operation failed because an addressed session could not be found. */ NO_SUCH_SESSION : new ErrorReason(107, "A requested session could not be found"), /** An operation failed due to using an incompatible data type. */ INCOMPATIBLE_DATATYPE : new ErrorReason(108, "Data type is incompatible"), /** A sent message was not handled by the specified recipient. */ UNHANDLED_MESSAGE : new ErrorReason(109, "A message was not handled"), /** A conflicting registration exists on the same branch of the topic tree. */ TOPIC_TREE_REGISTRATION_CONFLICT : new ErrorReason(200, "A conflicting registration exists on the same branch of the topic tree"), /** A conflicting registration exists on the server. */ HANDLER_CONFLICT : new ErrorReason(201, "Conflict with an existing handler"), /** An invalid path was supplied. */ INVALID_PATH : new ErrorReason(202, "Invalid path"), /** A recipient session has rejected a received message request. */ REJECTED_REQUEST : new ErrorReason(9003, "A request has been rejected by the recipient session") };