Skip to content

Commit

Permalink
fix error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
dojyorin committed Dec 28, 2023
1 parent 50af386 commit 7654fdd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/byte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface BlobType{
"base64": string;
"byte": Uint8Array;
"buffer": ArrayBuffer;
"stream": ReadableStream<Uint8Array>;
}

/**
Expand All @@ -24,6 +25,7 @@ export async function blobConvert<T extends keyof BlobType>(blob:Blob, type:T):P
case "base64": return <BlobType[T]>b64Encode(new Uint8Array(await blob.arrayBuffer()));
case "byte": return <BlobType[T]>new Uint8Array(await blob.arrayBuffer());
case "buffer": return <BlobType[T]>await blob.arrayBuffer();
case "stream": return <BlobType[T]>blob.stream();
default: throw new Error();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/env.deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function envGet<T extends keyof EnvType, U extends boolean>(key:string, t

if(env === undefined){
if(required){
throw new Error(key);
throw new Error();
}
else{
return <U extends true ? EnvType[T] : EnvType[T] | undefined>env;
Expand Down

0 comments on commit 7654fdd

Please sign in to comment.