Skip to content
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

Throw TypeError on incorrect MIME type #1054

Merged
merged 1 commit into from
May 12, 2017
Merged

Throw TypeError on incorrect MIME type #1054

merged 1 commit into from
May 12, 2017

Conversation

mtrofin
Copy link
Contributor

@mtrofin mtrofin commented May 4, 2017

Proposing that we throw TypeError when the Response parameter has incorrect MIME type. This seems more in-line to what we do for:

WebAssembly.{compile|instantiate}("hello!")

Proposing that we throw TypeError when the Response parameter has incorrect MIME type. This seems more in-line to what we do for:
WebAssembly.{compile|instantiate}("hello!")
@jfbastien
Copy link
Member

What do other Response APIs usually do?

@mtrofin
Copy link
Contributor Author

mtrofin commented May 11, 2017

@jfbastien I'm not sure there are other similar APIs (i.e. that take a Response object as parameter). Do you have an example in mind?

In absence of precedent, does the proposal here seem reasonable?

@annevk
Copy link
Member

annevk commented May 12, 2017

This looks reasonable to me, FWIW. It does clash with #1060 a bit but I can rebase (or fold this in there).

@jfbastien
Copy link
Member

This looks reasonable to me, FWIW. It does clash with #1060 a bit but I can rebase (or fold this in there).

Yeah it seems like differentiating actual compilation error from "your request was bad" or "ethernet cable was bent" or "you so teapot" is useful. #1060 adds another such throw condition which should probably be a TypeError.

So if that's the usual behavior for Response APIs then LGTM.

@rossberg
Copy link
Member

Agreed this is better. CompileError is supposed to specifically indicate a Wasm validation failure.

@mtrofin mtrofin merged commit e330cb8 into master May 12, 2017
@mtrofin mtrofin deleted the mtrofin-patch-1 branch May 12, 2017 14:00
@annevk
Copy link
Member

annevk commented May 12, 2017

@mtrofin this patch wasn't quite correct and you missed updating various places. I tried to account for them in an update to #1060.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants