@eventmsg/core
Version:
EventMsgV3 TypeScript library - Core protocol implementation with transport abstraction
73 lines (71 loc) • 1.87 kB
JavaScript
import { EventMsgError } from "./event-msg-error.js";
//#region src/errors/transport-error.ts
/**
* Error related to transport layer operations (connection, sending, receiving)
*/
var TransportError = class extends 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
export { ConnectionError, DisconnectionError, SendError, TransportError };
//# sourceMappingURL=transport-error.js.map