#1265 Add context to uncaught javascript exception

Merge realizado
herby mesclou 1 commits de max/exception_handling em amber/master há 2 anos atrás
1 ficheiros alterados com 5 adições e 0 exclusões
  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;
                 }