aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 76b3a8c..0c1ede8 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -1210,15 +1210,20 @@ Serve.prototype.image = function (path) {
if (err) return heresTheData(err)
buffer = Buffer.concat(buffer)
- jpeg.rotate(buffer, {}, function (err, rotatedBuffer, orientation) {
- if (!err) buffer = rotatedBuffer
+ try {
+ jpeg.rotate(buffer, {}, function (err, rotatedBuffer, orientation) {
+ if (!err) buffer = rotatedBuffer
- heresTheData(null, buffer)
- pull(
- pull.once(buffer),
- self.respondSink()
- )
- })
+ heresTheData(null, buffer)
+ pull(
+ pull.once(buffer),
+ self.respondSink()
+ )
+ })
+ } catch (err) {
+ console.trace(err)
+ self.respond(500, err.message || err)
+ }
}
done(function (err, data, type) {