EDIT(2019): in November 2016, a new feature was added to the Street View Image API to query for the availability of Street View panoramas at given locations (address or latlng), or even pano IDs. These queries are free of charge. This had been requested precisely to deal with the "Sorry we have no imagery here" status. See Street View Image Metadata documentation for more details.
The API only ever return images, and it'd break the user experience if it didn't.
When no imagery is found (or you run out of quota) the API returns an image with the error so that it's visible form an IMG tag or wherever the image is embedded.
If you'd prefer an error code, I image you'll be downloading the image form the API, checking for the error code, and then sending the image to the user if there was no error. For such scenario, a JSON output would help, but would need to be requested separately from the image itself (e.g. by additional request parameter). This sounds like it'd overlap with:
Issue 6908: Feature Request: Retrieve satellite photo tile date
in that it asks for text-only output. I'd recommend you file a feature request, or at least adding a comment on Issue 6908 to reflect that other details would be interesting to have in a text response.