I'm using ES6 in my project and am finding that no console errors are being shown. I'm using Gulp with Babel (require('gulp-babel');
) to transpile the ES6.
Take the following example: I instantiate a class which extends a parent, with method method1()
then call a method that doesn't exist super.method2()
in the child.
The program stops running but I get no errors. Why is this?
Other file:
...
API.Quest.getQuest(1).then((quest) => {
this.quest = new Quest(quest);
console.log('DONE'); // never gets here
}, (err) => {
console.log('ERR', err);
});
Classes:
class Event {
constructor(args, childEventClass, childEventClassName) {
this.name = args.name;
this.id = args.id;
this.children = args[childEventClassName].map(eventObj => new childEventClass(eventObj));
...
}
method1() {
console.log('Called parent method 1');
}
}
class Quest extends Event {
constructor(args) {
super(args, Task, 'tasks');
super.method2();
}
};
class Task extends Event {
...
};
Gulp:
const babel = require('gulp-babel');
...
gulp.task('scripts', function() {
return gulp.src([
'js/**/*.js',
])
.pipe(babel({
presets: ['es2015']
}))
.pipe(concatJs('main.js'))
.pipe(gulp.dest('build/js'));
});
Edit 2:
API.Quest.getQuest(1).then((quest) => {
// ...
}, (err) => {
console.error('REJECT ERR', err);
// Catch rejected promises
}).catch((err) => {
// Catch ?
console.error('CATCH ERR', err);
});