Skip to content

Commit

Permalink
Merge pull request #1487 from polywrap/fix/uri-resolver-ext-handle-nu…
Browse files Browse the repository at this point in the history
…ll-result

fix: handle null return values from uri resolver extensions
  • Loading branch information
dOrgJelli authored Jan 18, 2023
2 parents 40eca83 + b08a86e commit 031da0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/js/core/src/interfaces/uri-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Tracer } from "@polywrap/tracing-js";
import { Result } from "@polywrap/result";

export interface MaybeUriOrManifest {
uri?: string;
manifest?: Uint8Array;
uri?: string | null;
manifest?: Uint8Array | null;
}

export const module = {
Expand All @@ -32,8 +32,8 @@ export const module = {
invoker: Invoker,
wrapper: Uri,
path: string
): Promise<Result<Uint8Array | undefined, WrapError>> => {
return invoker.invoke<Uint8Array | undefined>({
): Promise<Result<Uint8Array | null, WrapError>> => {
return invoker.invoke<Uint8Array | null>({
uri: wrapper.uri,
method: "getFile",
args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class UriResolverExtensionFileReader implements IFileReader {
path
);
if (!result.ok) return result;
if (result.value === undefined) {
if (!result.value) {
return ResultErr(new Error(`File not found at ${path}`));
}
return {
Expand Down

0 comments on commit 031da0f

Please sign in to comment.