#1265 Add context to uncaught javascript exception

Fusionado
herby fusionadas 1 achegas de max/exception_handling en amber/master %!s(int64=2) %!d(string=hai) anos
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      lang/base/kernel-runtime.js

+ 5 - 0
lang/base/kernel-runtime.js

@@ -343,6 +343,11 @@ define(['./junk-drawer'], function ($goodies) {
             function resultWithNoErrorHandling (worker) {
                 try {
                     return worker(thisContext);
+                } catch (error) {
+                    if (error.context == null) {
+                        error.context = thisContext;
+                    }
+                    throw error;                                
                 } finally {
                     thisContext = null;
                 }