diff options
author | Kenneth Pouncey <kjpou@pt.lu> | 2019-11-25 11:09:34 +0300 |
---|---|---|
committer | Larry Ewing <lewing@microsoft.com> | 2019-11-25 17:23:45 +0300 |
commit | 64e2864fef2615c61b2f9feacd18671ee68ab575 (patch) | |
tree | 67e7f2d80f8240cb81943cad3476eb9b4cf50c83 | |
parent | 1ef7a298363799989bdfd08ef21bdcb367922c3b (diff) |
Add a more descriptive error in case of fetch response not returning back what it should.
- An example of this is when a Promise library is being used and the Promise can not be identified correctly. Thus the internal error.
-rw-r--r-- | sdks/wasm/framework/src/WebAssembly.Net.Http/WasmHttpMessageHandler.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sdks/wasm/framework/src/WebAssembly.Net.Http/WasmHttpMessageHandler.cs b/sdks/wasm/framework/src/WebAssembly.Net.Http/WasmHttpMessageHandler.cs index 8296becf674..23334f46a26 100644 --- a/sdks/wasm/framework/src/WebAssembly.Net.Http/WasmHttpMessageHandler.cs +++ b/sdks/wasm/framework/src/WebAssembly.Net.Http/WasmHttpMessageHandler.cs @@ -146,8 +146,10 @@ namespace WebAssembly.Net.Http.HttpClient { requestObject.Dispose (); - var response = (Task<object>)fetch.Invoke ("apply", window, args); + var response = fetch.Invoke ("apply", window, args) as Task<object>; args.Dispose (); + if (response == null) + throw new Exception("Internal error marshalling the response Promise from `fetch`."); var t = await response; |