From b47f6c48b548217bd46f4feb0c03239ad34ef176 Mon Sep 17 00:00:00 2001 From: Christian Jorgensen Date: Sun, 18 Feb 2024 13:11:34 +0100 Subject: [PATCH 1/2] Ignore error copying empty member --- src/api/Tools.ts | 3 ++- src/typings.ts | 1 + src/views/objectBrowser.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api/Tools.ts b/src/api/Tools.ts index 5cb450cd8..6123e4fb6 100644 --- a/src/api/Tools.ts +++ b/src/api/Tools.ts @@ -239,7 +239,8 @@ export namespace Tools { }) as IBMiMessage); return { messages, - findId: id => messages.find(m => m.id === id) + findId: id => messages.find(m => m.id === id), + length: messages.length } } diff --git a/src/typings.ts b/src/typings.ts index 63b03384b..c533e3cb2 100644 --- a/src/typings.ts +++ b/src/typings.ts @@ -199,6 +199,7 @@ export type IBMiMessage = { export type IBMiMessages = { messages: IBMiMessage[] findId(id: string): IBMiMessage | undefined + length: Number } export const IFS_BROWSER_MIMETYPE = "application/vnd.code.tree.ifsbrowser"; diff --git a/src/views/objectBrowser.ts b/src/views/objectBrowser.ts index 797fbdfac..49f8fef67 100644 --- a/src/views/objectBrowser.ts +++ b/src/views/objectBrowser.ts @@ -541,7 +541,7 @@ export function initializeObjectBrowser(context: vscode.ExtensionContext) { }) const messages = Tools.parseMessages(copyResult.stderr); - if (messages.findId(`CPF2869`)) { + if (messages.length && !messages.findId(`CPF2869`)) { throw (copyResult.stderr) } From e8b6d224e2da398afda7100ab8ea8efd44e4eea8 Mon Sep 17 00:00:00 2001 From: Christian Jorgensen Date: Tue, 20 Feb 2024 23:26:48 +0100 Subject: [PATCH 2/2] Correct use of 'Tools.parseMessages' --- src/api/Tools.ts | 3 +-- src/typings.ts | 1 - src/views/objectBrowser.ts | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/api/Tools.ts b/src/api/Tools.ts index 6123e4fb6..5cb450cd8 100644 --- a/src/api/Tools.ts +++ b/src/api/Tools.ts @@ -239,8 +239,7 @@ export namespace Tools { }) as IBMiMessage); return { messages, - findId: id => messages.find(m => m.id === id), - length: messages.length + findId: id => messages.find(m => m.id === id) } } diff --git a/src/typings.ts b/src/typings.ts index c533e3cb2..63b03384b 100644 --- a/src/typings.ts +++ b/src/typings.ts @@ -199,7 +199,6 @@ export type IBMiMessage = { export type IBMiMessages = { messages: IBMiMessage[] findId(id: string): IBMiMessage | undefined - length: Number } export const IFS_BROWSER_MIMETYPE = "application/vnd.code.tree.ifsbrowser"; diff --git a/src/views/objectBrowser.ts b/src/views/objectBrowser.ts index 49f8fef67..43e36ded2 100644 --- a/src/views/objectBrowser.ts +++ b/src/views/objectBrowser.ts @@ -540,8 +540,8 @@ export function initializeObjectBrowser(context: vscode.ExtensionContext) { noLibList: true }) - const messages = Tools.parseMessages(copyResult.stderr); - if (messages.length && !messages.findId(`CPF2869`)) { + const copyMessages = Tools.parseMessages(copyResult.stderr); + if (copyMessages.messages.length && !copyMessages.findId(`CPF2869`)) { throw (copyResult.stderr) }