From d8faf75a9cf5ce865e644a2568b82cf2a46668d4 Mon Sep 17 00:00:00 2001
From: Jake <jake.read@cba.mit.edu>
Date: Sun, 7 Jul 2019 09:17:44 -0400
Subject: [PATCH] ok, almost reloading

---
 gogetter.js               | 12 +++++++++++-
 hunks/interface/logger.js |  1 -
 hunks/manager.js          |  6 ++++--
 hunks/view.js             |  9 +++++++--
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/gogetter.js b/gogetter.js
index f6adbee..b3b1a94 100644
--- a/gogetter.js
+++ b/gogetter.js
@@ -75,6 +75,8 @@ function GoGetter() {
     // escape characters that are used to delimit the module URL.
     // this way the following module works: 'data:text/javascript,console.log("hello")'
     url = url.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
+    //
+    let ogurl = url;
     // try adding this query modifier to convince the browser it's new (if not, cannot refresh source)
     url += `?mtime=${performance.now()}`
     // to try...
@@ -82,7 +84,15 @@ function GoGetter() {
       import(url).then((obj) => {
         resolve(obj.default)
       }).catch((err) => {
-        reject(err)
+        // at these levels, probably ah syntax error
+        if(err.name === "SyntaxError"){
+          console.error("Syntax Error at Load")
+          console.error("in:", ogurl)
+          console.error("at line:", err.lineNumber)
+          reject(err)
+        } else {
+          reject(err)
+        }
       })
     })
     // ... previously, this hack... but why?
diff --git a/hunks/interface/logger.js b/hunks/interface/logger.js
index 14c9340..7db6204 100644
--- a/hunks/interface/logger.js
+++ b/hunks/interface/logger.js
@@ -23,7 +23,6 @@ function Logger() {
         // it is loaded and state is updated (from program)
         this.log('HELLO LOGGER')
         this.dom = $('<div>').get(0)
-        error here
     }
 
     this.onload = () => {
diff --git a/hunks/manager.js b/hunks/manager.js
index 1a4d9f6..a979d6d 100644
--- a/hunks/manager.js
+++ b/hunks/manager.js
@@ -171,8 +171,7 @@ function Manager() {
           hunks.push(hunk)
           resolve(hunk)
         } catch (err) {
-          console.error('the err from sourceto ?', err)
-          // HERE: not catching this anywhere upstream,
+          // think these are handled at importSource (logging wise, so just)
           reject(err)
         }
       }).catch((err) => {
@@ -465,6 +464,9 @@ function Manager() {
   }
 
   let idSafeError = (msgid, message) => {
+    // sends this upstream... tricky relationship for node / browser, bc
+    // browser can just log to console, but view wants to recv errors from all contexts in a
+    // similar manner, yikes ! 
     // also log this for chrissake
     console.log('MANAGER ERRMSG', message)
     // only do this if the message is < 256b ?
diff --git a/hunks/view.js b/hunks/view.js
index 773d285..41ac4dc 100644
--- a/hunks/view.js
+++ b/hunks/view.js
@@ -1593,14 +1593,19 @@ function View() {
     // ... not going to write the version of this that restores state
     // we ask for state on the reset
     let od = this.defs[indice]
-    console.log('your button works', od)
     // this in conjunction with error catching during the addhunk step ...
     // we can wrap all of this up in try / catch ? and delete things only when
     // those all pass ??
     // first, let's add in the new hunk:
     this.requestAddHunk(od.type).then((def) => {
-      // 
+      // look good, let's replace by: 
     }).catch((err) => {
+      this.changeContextTitle('error on reload, see consoles')
+      setTimeout(() => {
+        $(this.dom).find('.contextmenu').fadeOut(400, function() {
+          $(this).remove()
+        })
+      }, 2000)
       console.error('caught request add hunk error from reload site')
     })
     // let's load one in w/ the changes ... if we can do this we'll go thru the rest
-- 
GitLab