From 454d27df45ca1237ad2562c1ee5e2f86624c8fa9 Mon Sep 17 00:00:00 2001 From: krisbitney Date: Wed, 28 Sep 2022 11:07:32 +0500 Subject: [PATCH 1/3] correctly handling error in addAllImplementationsFromImplementationsArray in get-implementations.ts --- .../js/core/src/algorithms/get-implementations.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 359313941c..756bd43ceb 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -23,7 +23,7 @@ export const getImplementations = Tracer.traceFunc( const addAllImplementationsFromImplementationsArray = ( implementationsArray: readonly InterfaceImplementations[], wrapperInterfaceUri: Uri - ) => { + ): Result => { for (const interfaceImplementations of implementationsArray) { let fullyResolvedUri: Uri; if (redirects) { @@ -32,7 +32,7 @@ export const getImplementations = Tracer.traceFunc( redirects ); if (!redirectsResult.ok) { - continue; + throw redirectsResult.error; } fullyResolvedUri = redirectsResult.value; } else { @@ -45,6 +45,7 @@ export const getImplementations = Tracer.traceFunc( } } } + return ResultOk(true); }; let finalUri = wrapperInterfaceUri; @@ -57,8 +58,11 @@ export const getImplementations = Tracer.traceFunc( finalUri = redirectsResult.value; } - addAllImplementationsFromImplementationsArray(interfaces, finalUri); + const addAllImp = addAllImplementationsFromImplementationsArray( + interfaces, + finalUri + ); - return ResultOk(result); + return addAllImp.ok ? ResultOk(result) : addAllImp; } ); From 647b579b580dfa2a7f6c10d7cad59935f54c95e0 Mon Sep 17 00:00:00 2001 From: krisbitney Date: Wed, 28 Sep 2022 19:01:56 +0500 Subject: [PATCH 2/3] fixed throw/Result statement in getImplementations --- packages/js/core/src/algorithms/get-implementations.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 756bd43ceb..2769fae183 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -32,7 +32,7 @@ export const getImplementations = Tracer.traceFunc( redirects ); if (!redirectsResult.ok) { - throw redirectsResult.error; + return redirectsResult; } fullyResolvedUri = redirectsResult.value; } else { From df20049ac9fc2745bdb240c85727f2d2b537ed1b Mon Sep 17 00:00:00 2001 From: krisbitney Date: Thu, 29 Sep 2022 20:55:19 +0500 Subject: [PATCH 3/3] changed return type of inner method in getImplementations from Result to Result --- packages/js/core/src/algorithms/get-implementations.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/js/core/src/algorithms/get-implementations.ts b/packages/js/core/src/algorithms/get-implementations.ts index 2769fae183..f6588a61a6 100644 --- a/packages/js/core/src/algorithms/get-implementations.ts +++ b/packages/js/core/src/algorithms/get-implementations.ts @@ -23,7 +23,7 @@ export const getImplementations = Tracer.traceFunc( const addAllImplementationsFromImplementationsArray = ( implementationsArray: readonly InterfaceImplementations[], wrapperInterfaceUri: Uri - ): Result => { + ): Result => { for (const interfaceImplementations of implementationsArray) { let fullyResolvedUri: Uri; if (redirects) { @@ -45,7 +45,7 @@ export const getImplementations = Tracer.traceFunc( } } } - return ResultOk(true); + return ResultOk(undefined); }; let finalUri = wrapperInterfaceUri;