1
0
Pārlūkot izejas kodu

Attach context to a javascript exception

massimomilan 2 gadi atpakaļ
vecāks
revīzija
b4e364d600
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  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;
                 }