@eventmsg/core
Version:
EventMsgV3 TypeScript library - Core protocol implementation with transport abstraction
76 lines (74 loc) • 2 kB
JavaScript
const require_event_msg_error = require('./event-msg-error.cjs');
//#region src/errors/transport-error.ts
/**
* Error related to transport layer operations (connection, sending, receiving)
*/
var TransportError = class extends require_event_msg_error.EventMsgError {
constructor(message, options = {}) {
super(message, "TRANSPORT_ERROR", {
...options,
solutions: options.solutions || [
"Check transport connection",
"Verify transport configuration",
"Retry the operation"
]
});
}
};
/**
* Transport connection failed
*/
var ConnectionError = class extends TransportError {
constructor(message = "Failed to connect to transport", options = {}) {
super(message, {
...options,
solutions: [
"Check if the device is available",
"Verify connection parameters",
"Ensure no other process is using the transport",
"Check device permissions"
]
});
this.code = "CONNECTION_ERROR";
}
};
/**
* Transport send operation failed
*/
var SendError = class extends TransportError {
constructor(message = "Failed to send data through transport", options = {}) {
super(message, {
...options,
solutions: [
"Check transport connection status",
"Verify message size is within limits",
"Retry sending the message",
"Check for transport buffer overflow"
]
});
this.code = "SEND_ERROR";
}
};
/**
* Transport disconnection error
*/
var DisconnectionError = class extends TransportError {
constructor(message = "Transport disconnected unexpectedly", options = {}) {
super(message, {
...options,
solutions: [
"Check physical connection",
"Implement reconnection logic",
"Monitor connection status",
"Handle graceful disconnection"
]
});
this.code = "DISCONNECTION_ERROR";
}
};
//#endregion
exports.ConnectionError = ConnectionError;
exports.DisconnectionError = DisconnectionError;
exports.SendError = SendError;
exports.TransportError = TransportError;
//# sourceMappingURL=transport-error.cjs.map