Skip to content

Commit

Permalink
chore: improve UriResolverExtensionFileReader error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
dOrgJelli committed Oct 11, 2022
1 parent 63c7e36 commit accbdb5
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class UriResolverExtensionFileReader implements IFileReader {
) {}

async readFile(filePath: string): Promise<Result<Uint8Array, Error>> {
const path = combinePaths(this.wrapperUri.path, filePath);
const result = await UriResolverInterface.module.getFile(
{
invoke: <TData = unknown, TUri extends Uri | string = string>(
Expand All @@ -30,11 +31,11 @@ export class UriResolverExtensionFileReader implements IFileReader {
this.client.invokeWrapper<TData, TUri>(options),
},
this.resolverExtensionUri,
combinePaths(this.wrapperUri.path, filePath)
path
);
if (!result.ok) return result;
if (!result.value) {
return ResultErr(new Error(`File not found at ${filePath}`));
return ResultErr(new Error(`File not found at ${path}`));
}
return result;
}
Expand Down

0 comments on commit accbdb5

Please sign in to comment.