Skip to content

Commit

Permalink
fix error results for new development backend image manipulation func…
Browse files Browse the repository at this point in the history
…tions.
  • Loading branch information
bago committed May 25, 2022
1 parent 926e576 commit 704175a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ app.get('/img/', function(req, res) {
.color([{ apply: 'xor', params: ['#B0B0B0'] }], function (err, tempImg2) {
if (err) {
console.log("Error #1 creating placeholder: ", err);
res.status(500);
res.status(500).send('Error #1 creating placeholder: ' + err.message);
} else {
image.blit(tempImg2, 0, 0)
.getBuffer(Jimp.MIME_PNG, function(error, buffer) {
if (error) {
console.log("Error #2 creating placeholder: ", error);
res.status(500);
res.status(500).send('Error #1 creating placeholder: ' + err.message);
} else res.status(200).send(new Buffer(buffer));
});
}
Expand All @@ -140,8 +140,8 @@ app.get('/img/', function(req, res) {
var ir = Jimp.read(src, function(err, image) {

if (err) {
console.log("Error reading image: ", err);
res.status(404);
console.log("Error reading image: ", err.message);
res.status(404).send('Not found');
} else {

// "aspect" method is currently unused, but we're evaluating it.
Expand All @@ -160,12 +160,12 @@ app.get('/img/', function(req, res) {
var sendOrError = function(err, image) {
if (err) {
console.log("Error manipulating image: ", err);
res.status(500);
res.status(500).send('Unexpected condition: ' + err.message);
} else {
image.getBuffer(Jimp.MIME_PNG, function(error, buffer) {
if (error) {
console.log("Error sending manipulated image: ", error);
res.status(500);
res.status(500).send('Unexpected condition manipulating image: ' + error.message);
} else res.status(200).send(new Buffer(buffer));
});
}
Expand Down

0 comments on commit 704175a

Please sign in to comment.