From f93e40d72c8671791a5307ebebe6482e54e50c80 Mon Sep 17 00:00:00 2001
From: David <github.site@torick.net>
Date: Thu, 26 Aug 2021 16:57:38 -0400
Subject: [PATCH] fix: Exception was not reprotyed properly in async calls on
 WASM

---
 src/Uno.UI/ts/Interop/AsyncInteropHelper.ts | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/Uno.UI/ts/Interop/AsyncInteropHelper.ts b/src/Uno.UI/ts/Interop/AsyncInteropHelper.ts
index a24fa10f6c92..3ada13381def 100644
--- a/src/Uno.UI/ts/Interop/AsyncInteropHelper.ts
+++ b/src/Uno.UI/ts/Interop/AsyncInteropHelper.ts
@@ -28,10 +28,22 @@
 						}
 					})
 					.catch(err => {
-						AsyncInteropHelper.dispatchErrorMethod(handle, err);
+						if (typeof err == "string") {
+							AsyncInteropHelper.dispatchErrorMethod(handle, err);
+						} else if (err.message && err.stack) {
+							AsyncInteropHelper.dispatchErrorMethod(handle, err.message + "\n" + err.stack);
+						} else {
+							AsyncInteropHelper.dispatchErrorMethod(handle, "" + err);
+						}
 					});
 			} catch (err) {
-				AsyncInteropHelper.dispatchErrorMethod(handle, err);
+				if (typeof err == "string") {
+					AsyncInteropHelper.dispatchErrorMethod(handle, err);
+				} else if (err.message && err.stack) {
+					AsyncInteropHelper.dispatchErrorMethod(handle, err.message + "\n" + err.stack);
+				} else {
+					AsyncInteropHelper.dispatchErrorMethod(handle, "" + err);
+				}
 			}
 		}
 	}