UNPKG

wampy

Version:

Amazingly fast, feature-rich, lightweight WAMP Javascript client (for browser and node.js)

290 lines (289 loc) 8.06 kB
// src/constants.ts var WAMP_ERROR_MSG = { SUCCESS: "Success!", URI_ERROR: "Topic URI doesn't meet requirements!", NO_BROKER: "Server doesn't provide broker role!", NO_CALLBACK_SPEC: "No required callback function specified!", INVALID_PARAM: "Invalid parameter(s) specified!", NO_SERIALIZER_AVAILABLE: "Server has chosen a serializer, which is not available!", NON_EXIST_UNSUBSCRIBE: "Trying to unsubscribe from non existent subscription!", NO_DEALER: "Server doesn't provide dealer role!", RPC_ALREADY_REGISTERED: "RPC already registered!", NON_EXIST_RPC_UNREG: "Received rpc unregistration for non existent rpc!", NON_EXIST_RPC_INVOCATION: "Received invocation for non existent rpc!", NON_EXIST_RPC_REQ_ID: "No RPC calls in action with specified request ID!", NO_REALM: "No realm specified!", NO_WS_OR_URL: "No websocket provided or URL specified is incorrect!", NO_CRA_CB_OR_ID: "No onChallenge callback or authid was provided for authentication!", CHALLENGE_EXCEPTION: "Exception raised during challenge processing", PPT_NOT_SUPPORTED: "Payload Passthru Mode is not supported by the router", PPT_INVALID_SCHEME: "Provided PPT scheme is invalid", PPT_SRLZ_INVALID: "Provided PPT serializer is invalid or not supported", PPT_SRLZ_ERR: "Can not serialize/deserialize payload", PROTOCOL_VIOLATION: "Protocol violation", WAMP_ABORT: "Router aborted connection", WAMP_GENERAL_ERROR: "Wamp error", WEBSOCKET_ERROR: "Websocket error", FEATURE_NOT_SUPPORTED: "Feature not supported" }; var isNode = typeof process === "object" && Object.prototype.toString.call(process) === "[object process]"; // src/errors.ts var UriError = class extends Error { code = 1; constructor() { super(WAMP_ERROR_MSG.URI_ERROR); this.name = "UriError"; } }; var NoBrokerError = class extends Error { code = 2; constructor() { super(WAMP_ERROR_MSG.NO_BROKER); this.name = "NoBrokerError"; } }; var NoCallbackError = class extends Error { code = 3; constructor() { super(WAMP_ERROR_MSG.NO_CALLBACK_SPEC); this.name = "NoCallbackError"; } }; var InvalidParamError = class extends Error { code = 4; parameter; constructor(parameter) { super(WAMP_ERROR_MSG.INVALID_PARAM); this.name = "InvalidParamError"; this.parameter = parameter; } }; var NoSerializerAvailableError = class extends Error { code = 6; constructor() { super(WAMP_ERROR_MSG.NO_SERIALIZER_AVAILABLE); this.name = "NoSerializerAvailableError"; } }; var NonExistUnsubscribeError = class extends Error { code = 7; constructor() { super(WAMP_ERROR_MSG.NON_EXIST_UNSUBSCRIBE); this.name = "NonExistUnsubscribeError"; } }; var NoDealerError = class extends Error { code = 12; constructor() { super(WAMP_ERROR_MSG.NO_DEALER); this.name = "NoDealerError"; } }; var RPCAlreadyRegisteredError = class extends Error { code = 15; constructor() { super(WAMP_ERROR_MSG.RPC_ALREADY_REGISTERED); this.name = "RPCAlreadyRegisteredError"; } }; var NonExistRPCUnregistrationError = class extends Error { code = 17; constructor() { super(WAMP_ERROR_MSG.NON_EXIST_RPC_UNREG); this.name = "NonExistRPCUnregistrationError"; } }; var NonExistRPCReqIdError = class extends Error { code = 20; constructor() { super(WAMP_ERROR_MSG.NON_EXIST_RPC_REQ_ID); this.name = "NonExistRPCReqIdError"; } }; var NoRealmError = class extends Error { code = 21; constructor() { super(WAMP_ERROR_MSG.NO_REALM); this.name = "NoRealmError"; } }; var NoWsOrUrlError = class extends Error { code = 22; constructor() { super(WAMP_ERROR_MSG.NO_WS_OR_URL); this.name = "NoWsOrUrlError"; } }; var NoCRACallbackOrIdError = class extends Error { code = 23; errorUri = "wamp.error.cannot_authenticate"; constructor() { super(WAMP_ERROR_MSG.NO_CRA_CB_OR_ID); this.name = "NoCRACallbackOrIdError"; } }; var ChallengeExceptionError = class extends Error { code = 24; errorUri = "wamp.error.cannot_authenticate"; constructor() { super(WAMP_ERROR_MSG.CHALLENGE_EXCEPTION); this.name = "ChallengeExceptionError"; } }; var PPTNotSupportedError = class extends Error { code = 25; constructor() { super(WAMP_ERROR_MSG.PPT_NOT_SUPPORTED); this.name = "PPTNotSupportedError"; } }; var PPTInvalidSchemeError = class extends Error { code = 26; constructor() { super(WAMP_ERROR_MSG.PPT_INVALID_SCHEME); this.name = "PPTInvalidSchemeError"; } }; var PPTSerializerInvalidError = class extends Error { code = 27; constructor() { super(WAMP_ERROR_MSG.PPT_SRLZ_INVALID); this.name = "PPTSerializerInvalidError"; } }; var PPTSerializationError = class extends Error { code = 28; constructor() { super(WAMP_ERROR_MSG.PPT_SRLZ_ERR); this.name = "PPTSerializationError"; } }; var ProtocolViolationError = class extends Error { code = 29; errorUri; constructor(errorUri, details) { super(details || WAMP_ERROR_MSG.PROTOCOL_VIOLATION); this.name = "ProtocolViolationError"; this.errorUri = errorUri; } }; var AbortError = class extends Error { code = 30; errorUri; details; constructor({ error, details }) { super(WAMP_ERROR_MSG.WAMP_ABORT); this.name = "AbortedError"; this.errorUri = error; this.details = details; } }; var WampError = class extends Error { code = 31; errorUri; details; argsList; argsDict; constructor({ error, details, argsList, argsDict }) { super(WAMP_ERROR_MSG.WAMP_GENERAL_ERROR); this.name = "WampError"; this.errorUri = error; this.details = details; this.argsList = argsList; this.argsDict = argsDict; } }; var SubscribeError = class extends WampError { code = 32; constructor({ error, details, argsList, argsDict }) { super({ error, details, argsList, argsDict }); this.name = "SubscribeError"; } }; var UnsubscribeError = class extends WampError { code = 33; constructor({ error, details, argsList, argsDict }) { super({ error, details, argsList, argsDict }); this.name = "UnsubscribeError"; } }; var PublishError = class extends WampError { code = 34; constructor({ error, details, argsList, argsDict }) { super({ error, details, argsList, argsDict }); this.name = "PublishError"; } }; var RegisterError = class extends WampError { code = 35; constructor({ error, details, argsList, argsDict }) { super({ error, details, argsList, argsDict }); this.name = "RegisterError"; } }; var UnregisterError = class extends WampError { code = 36; constructor({ error, details, argsList, argsDict }) { super({ error, details, argsList, argsDict }); this.name = "UnregisterError"; } }; var CallError = class extends WampError { code = 37; constructor({ error, details, argsList, argsDict }) { super({ error, details, argsList, argsDict }); this.name = "CallError"; } }; var WebsocketError = class extends Error { code = 38; error; constructor(error) { super(WAMP_ERROR_MSG.WEBSOCKET_ERROR); this.name = "WebsocketError"; this.error = error; } }; var FeatureNotSupportedError = class extends Error { code = 39; role; feature; constructor(role, feature) { super(WAMP_ERROR_MSG.FEATURE_NOT_SUPPORTED); this.name = "FeatureNotSupportedError"; this.role = role; this.feature = feature; } }; export { AbortError, CallError, ChallengeExceptionError, FeatureNotSupportedError, InvalidParamError, NoBrokerError, NoCRACallbackOrIdError, NoCallbackError, NoDealerError, NoRealmError, NoSerializerAvailableError, NoWsOrUrlError, NonExistRPCReqIdError, NonExistRPCUnregistrationError, NonExistUnsubscribeError, PPTInvalidSchemeError, PPTNotSupportedError, PPTSerializationError, PPTSerializerInvalidError, ProtocolViolationError, PublishError, RPCAlreadyRegisteredError, RegisterError, SubscribeError, UnregisterError, UnsubscribeError, UriError, WampError, WebsocketError }; //# sourceMappingURL=errors.js.map