I have a database table which stores Incident details. Each Incident can have an image saved for it. There are some Incidents which will not have an image for it.
I have an API which pulls the image for a given Incident. I have an issue with handling the API in case an Incident doesn't have the image.
What is the best approach to handle this (and why :) )?:
- Telling the client in advance which Incident has the image, and which don't. So the client calling the API should only call it when there is an image for the Incident.
- Sending a predefined error message as the result.
- Sending a generic placeholder like image to the client when an image is not available for the Incident.