diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-08-28 20:03:00 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-08-28 20:03:00 +0100 |
| commit | d333cee1c7a7f95cadf5b59e8dbb0124d73852df (patch) | |
| tree | f837b57e640eb9bad909416c6822f6edb9d192ac /lib | |
| parent | b1ae23f544c479d2b71347bbf67df7baac40d78f (diff) | |
Add test explicitly for image error handling
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/document-to-html.js | 4 | ||||
| -rw-r--r-- | lib/promises.js | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js index e022946..6094803 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -193,7 +193,9 @@ function DocumentConversion(options, comments) { function recoveringConvertImage(convertImage) { return function(image, messages) { - return convertImage(image, messages).caught(function(error) { + return promises.attempt(function() { + return convertImage(image, messages); + }).caught(function(error) { messages.push(results.error(error)); return []; }); diff --git a/lib/promises.js b/lib/promises.js index 24dc34a..010631f 100644 --- a/lib/promises.js +++ b/lib/promises.js @@ -9,6 +9,7 @@ exports.props = bluebird.props; exports.reject = bluebird.reject; exports.promisify = bluebird.promisify; exports.mapSeries = bluebird.mapSeries; +exports.attempt = bluebird.attempt; exports.nfcall = function(func) { var args = Array.prototype.slice.call(arguments, 1); |
