From 6af9455cbbafeaad3e59d9db7a12cde60952e7fd Mon Sep 17 00:00:00 2001 From: Graham Bates Date: Sun, 19 Nov 2023 23:35:29 +0000 Subject: [PATCH] fix: check error type --- src/breakpointManager.ts | 4 +++- src/debugSession.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/breakpointManager.ts b/src/breakpointManager.ts index ef7b8ea..5ec8d78 100644 --- a/src/breakpointManager.ts +++ b/src/breakpointManager.ts @@ -167,7 +167,9 @@ class BreakpointManager { const type = accessType ? types[accessType] : BreakpointCode.ACCESS; await this.gdb.removeBreakpoint(address, type, ref.size); } catch (err) { - logger.error((err as Error).message); + if (err instanceof Error) { + logger.error(err.message); + } } } this.dataBreakpoints.clear(); diff --git a/src/debugSession.ts b/src/debugSession.ts index 34bd7b3..89f7723 100644 --- a/src/debugSession.ts +++ b/src/debugSession.ts @@ -352,7 +352,9 @@ export class UAEDebugSession extends LoggingDebugSession { } catch (err) { this.sendEvent(new TerminatedEvent()); response.success = false; - response.message = (err as Error).message; + if (err instanceof Error) { + response.message = err.message; + } } this.sendResponse(response);