Skip to content

Commit

Permalink
Global require.on error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Feb 6, 2018
1 parent 1f063e1 commit 8f42970
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@

// create a JBrowse global variable holding the JBrowse instance
JBrowse = new Browser( config );
require.on('error', function(error) {
JBrowse.fatalError('Failed to load resource: '+error.info[0]);
});
});
</script>

Expand Down
6 changes: 0 additions & 6 deletions src/JBrowse/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,9 @@ initPlugins: function() {
return new Deferred();
});

var handler = require.on("error", function(error) {
console.error(error);
deferred.reject('A resource failed to load '+error.src + ':' + error.info[0]);
});

// fire the "all plugins done" deferred when all of the plugins are done loading
(new DeferredList( pluginDeferreds ))
.then( function() {
handler && handler.remove();
deferred.resolve({success: true});
});

Expand Down
6 changes: 0 additions & 6 deletions src/JBrowse/View/Track/CanvasFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,8 @@ return declare(
var thisB = this;
this.glyphsBeingLoaded[glyphClassName] = [callback];

var handler = require.on("error", function(error) {
console.error(error);
errorCallback('A resource failed to load '+error.src + ':' + error.info[0]);
});

require( [glyphClassName], function( GlyphClass ) {

handler && handler.remove();
// if this require came back after we are already destroyed, just ignore it
if( thisB.destroyed )
return;
Expand Down

0 comments on commit 8f42970

Please sign in to comment.