Log errors in preload script instead of rethrowing
authorPaul Betts <paul@paulbetts.org>
Fri, 1 May 2015 23:10:45 +0000 (16:10 -0700)
committerPaul Betts <paul@paulbetts.org>
Fri, 1 May 2015 23:11:56 +0000 (16:11 -0700)
At some point, unhandled errors in preload scripts stopped being logged
to console, meaning that preload scripts were very difficult to debug.
Instead, print the error to console (which is what we wanted to have
happen anyways)

atom/renderer/lib/init.coffee

index 43d0fa9..1e0167d 100644 (file)
@@ -103,5 +103,8 @@ if preloadScript
   try
     require preloadScript
   catch error
-    throw error unless error.code is 'MODULE_NOT_FOUND'
-    console.error "Unable to load preload script #{preloadScript}"
+    if error.code is 'MODULE_NOT_FOUND'
+      console.error "Unable to load preload script #{preloadScript}"
+    else
+      console.error(error)
+      console.error(error.stack)