Skip to content

Commit

Permalink
Updated to propagate errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rgubby committed Feb 17, 2016
1 parent fec53c8 commit 13c310a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions citeproc-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ function Citeproc (citations, styleLocation, localeLocation, done) {
this.construct = function () {
var self = this;

self.loadStyle(styleLocation, function () {
self.loadLocale(localeLocation, function () {
self.loadStyle(styleLocation, function (err) {
if (err) return done(err);
self.loadLocale(localeLocation, function (err) {
if (err) return done(err);
self.setupSys();
citeproc = new CSL.Engine(sys, style);
done(citeproc);
done(null, citeproc);
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ describe('citeproc-js', function () {
var style = './styles/chicago-fullnote-bibliography.csl';
var locale = './locales/locales-nb-NO.xml';

var cite = new Citeproc(citations, style, locale, function (citeproc) {
var cite = new Citeproc(citations, style, locale, function (err, citeproc) {
citeproc.updateItems(Object.keys(citations));
var bibliography = citeproc.makeBibliography();
console.log(bibliography);
done();
done(err);
});
});
});

0 comments on commit 13c310a

Please sign in to comment.