Updated "getFile" to send a 404 for ENOENT errors
getFile sends a 500 error response when the requested file cannot be found, but the status code probably should be 404. This change sets the status of the error to 404 when the error code is "ENOENT".
This commit is contained in:
parent
537e1158d4
commit
970ecc7901
|
@ -210,6 +210,10 @@ StorageService.prototype.getFiles = function(container, options, cb) {
|
|||
*/
|
||||
StorageService.prototype.getFile = function(container, file, cb) {
|
||||
return this.client.getFile(container, file, function(err, f) {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
err.statusCode = err.status = 404;
|
||||
return cb(err);
|
||||
}
|
||||
return cb(err, map(f));
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue