Skip to content

Show meaningful error message on missing file #2360

@JoaquimLey

Description

@JoaquimLey

What are you trying to achieve?
I have the following sequence using sharp

const result = await sharp(inputBuffer)
        .resize(460)
        .composite([{ input: watermark, gravity: 'center' }])
        .toFormat('webp', { quality: 90 })
        .toBuffer();

Everything should work as expected, the issue is:

  • I've actually moved the current file where this processing takes place, therefore the watermark input file has a different path.
  • One could argue I should use fully qualified paths but the issue I have is with the error message
Error: Input file is missing

I Found it super strange as this used to work just fine, but outputting this generic error got me through a google+stackoverflow+this-repo-issues rabbit hole thinking it was actually an issue with the inputBuffer.

Suggestion

A better output would be

Error: Could not <composite|process|etc> Input file at <provided path> is missing

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions