chore(Viewer): handle import error outside try/catch
This commit is contained in:
parent
9b2a07d958
commit
e0104e3589
|
@ -22,7 +22,7 @@ var Diagram = require('diagram-js'),
|
|||
|
||||
var inherits = require('inherits');
|
||||
|
||||
var Importer = require('./import/Importer');
|
||||
var importBpmnDiagram = require('./import/Importer').importBpmnDiagram;
|
||||
|
||||
|
||||
function checkValidationError(err) {
|
||||
|
@ -292,6 +292,8 @@ Viewer.prototype.saveSVG = function(options, done) {
|
|||
|
||||
Viewer.prototype.importDefinitions = function(definitions, done) {
|
||||
|
||||
var err;
|
||||
|
||||
// use try/catch to not swallow synchronous exceptions
|
||||
// that may be raised during model parsing
|
||||
try {
|
||||
|
@ -305,12 +307,13 @@ Viewer.prototype.importDefinitions = function(definitions, done) {
|
|||
this._definitions = definitions;
|
||||
|
||||
// perform graphical import
|
||||
Importer.importBpmnDiagram(this, definitions, done);
|
||||
return importBpmnDiagram(this, definitions, done);
|
||||
} catch (e) {
|
||||
|
||||
// handle synchronous errors
|
||||
done(e);
|
||||
err = e;
|
||||
}
|
||||
|
||||
// handle synchronous errors
|
||||
return done(err);
|
||||
};
|
||||
|
||||
Viewer.prototype.getModules = function() {
|
||||
|
|
Loading…
Reference in New Issue