Skip to content

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
martijngastkemper committed Jul 7, 2023
1 parent 914cb61 commit 27bda35
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cli/resize-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const dimensions = size.split("x");
const width = dimensions[0] && parseInt(dimensions[0], 10);
const height = dimensions[1] && parseInt(dimensions[1], 10);
if (!width && !height) {
throw new Error("Unable to deduce dimensions.");
throw new Error(`Unable to deduce dimensions from "${size}".`);
}

const options = toSharpOptions({
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports.handler = async function handler(event, context, callback) {
const width = dimensions[0] && parseInt(dimensions[0], 10);
const height = dimensions[1] && parseInt(dimensions[1], 10);
if (!width && !height) {
throw new Error("Unable to deduce dimensions.");
throw new Error(`Unable to deduce dimensions from "${size}".`);
}

const object = await S3.send(
Expand Down
2 changes: 1 addition & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ app.get("*", async function (req, res, next) {
const width = dimensions[0] && parseInt(dimensions[0], 10);
const height = dimensions[1] && parseInt(dimensions[1], 10);
if (!width && !height) {
console.error("Unable to deduce dimensions.");
console.error(`Unable to deduce dimensions from "${size}".`);
}

/**
Expand Down

0 comments on commit 27bda35

Please sign in to comment.