Skip to content

Commit

Permalink
Improve serial error logging (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert authored Nov 13, 2024
1 parent a0f4b98 commit 60dd055
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class DeviceConnectionEventMap {
"status": ConnectionStatusEvent;
"serialdata": SerialDataEvent;
"serialreset": Event;
"serialerror": Event;
"serialerror": SerialErrorEvent;
"flash": Event;
"beforerequestdevice": Event;
"afterrequestdevice": Event;
Expand Down
5 changes: 3 additions & 2 deletions lib/usb-radio-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
DeviceConnection,
DeviceConnectionEventMap,
SerialDataEvent,
SerialErrorEvent,
} from "./device.js";
import { TypedEventTarget } from "./events.js";
import { Logging, NullLogging } from "./logging.js";
Expand Down Expand Up @@ -223,8 +224,8 @@ class RadioBridgeSerialSession {
private connectionCheckIntervalId: ReturnType<typeof setInterval> | undefined;
private isRestartingConnection: boolean = false;

private serialErrorListener = (e: unknown) => {
this.logging.error("Serial error", e);
private serialErrorListener = (event: SerialErrorEvent) => {
this.logging.error("SerialError:", event.error);
void this.dispose();
};

Expand Down

0 comments on commit 60dd055

Please sign in to comment.