Skip to content

Commit

Permalink
Error catchers for resolvers
Browse files Browse the repository at this point in the history
Signed-off-by: worksofliam <[email protected]>
  • Loading branch information
worksofliam committed Dec 6, 2024
1 parent 8c22027 commit 4c73d75
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions extension/server/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,23 @@ export async function memberResolve(baseUri: string, member: string, file: strin

if (resolvedMembers[baseUri] && resolvedMembers[baseUri][fileKey]) return resolvedMembers[baseUri][fileKey];

const resolvedMember = await queue.add(() => {return connection.sendRequest("memberResolve", [member, file])}) as IBMiMember|undefined;
// const resolvedMember = await connection.sendRequest("memberResolve", [member, file]) as IBMiMember|undefined;

if (resolvedMember) {
if (!resolvedMembers[baseUri]) resolvedMembers[baseUri] = {};
resolvedMembers[baseUri][fileKey] = resolvedMember;
try {
const resolvedMember = await queue.add(() => {return connection.sendRequest("memberResolve", [member, file])}) as IBMiMember|undefined;
// const resolvedMember = await connection.sendRequest("memberResolve", [member, file]) as IBMiMember|undefined;

if (resolvedMember) {
if (!resolvedMembers[baseUri]) resolvedMembers[baseUri] = {};
resolvedMembers[baseUri][fileKey] = resolvedMember;
}

return resolvedMember;
} catch (e) {
console.log(`Member resolve failed.`);
console.log(JSON.stringify({baseUri, member, file}));
console.log(e);
}

return resolvedMember;
return undefined;
}

export async function streamfileResolve(baseUri: string, base: string[]): Promise<string|undefined> {
Expand All @@ -82,15 +90,23 @@ export async function streamfileResolve(baseUri: string, base: string[]): Promis

const paths = (workspace ? includePath[workspace.uri] : []) || [];

const resolvedPath = await queue.add(() => {return connection.sendRequest("streamfileResolve", [base, paths])}) as string|undefined;
// const resolvedPath = await connection.sendRequest("streamfileResolve", [base, paths]) as string|undefined;
try {
const resolvedPath = await queue.add(() => {return connection.sendRequest("streamfileResolve", [base, paths])}) as string|undefined;
// const resolvedPath = await connection.sendRequest("streamfileResolve", [base, paths]) as string|undefined;

if (resolvedPath) {
if (!resolvedStreamfiles[baseUri]) resolvedStreamfiles[baseUri] = {};
resolvedStreamfiles[baseUri][baseString] = resolvedPath;
}

if (resolvedPath) {
if (!resolvedStreamfiles[baseUri]) resolvedStreamfiles[baseUri] = {};
resolvedStreamfiles[baseUri][baseString] = resolvedPath;
return resolvedPath;
} catch (e) {
console.log(`Streamfile resolve failed.`);
console.log(JSON.stringify({baseUri, base, paths}));
console.log(e);
}

return resolvedPath;
return undefined;
}

export function getWorkingDirectory(): Promise<string|undefined> {
Expand Down

0 comments on commit 4c73d75

Please sign in to comment.