-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wasm wrapper fixes and tests #1284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good! I added some comments about things that it looks like you've already considered but that I thought were worth checking.
| GetManifestOptions, | ||
fileReaderOrManifestOptions?: IFileReader | GetManifestOptions, | ||
manifestOptions?: GetManifestOptions | ||
): Promise<WasmWrapper> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this return a Result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah I think we should start propagating errors instead of throwing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is intended to be used (and be very ergonomic) when the developer knows it will not fail (or doesn't care) because he's using compiled wrapper binaries (manifest and wasm module buffers).
E.g.
const client = new PolywrapClient({
resolver: RecursiveResolver.from([
...,
{ uri: "some-uri", wrapper: await WasmWrapper.from(manifestBuffer, wamModule) }
])
});
If the developer wants a safe
version (that returs Result) he can use WasmPackage.from().createWrapper() which is less ergonomic but gets the job done :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kris left two great points around propagating errors via Result<T, E>
and optimizing the conditional statements. I think these things should be fixed before merging.
No description provided.