Better handling of invalid ids
This commit is contained in:
parent
c8eb31116c
commit
a33570e1d0
2 changed files with 10 additions and 5 deletions
|
@ -13,8 +13,10 @@ module.exports.match = function(url, type) {
|
|||
module.exports.lookupId = function(id, type) {
|
||||
var deferred = Q.defer();
|
||||
spotify.lookup({id: id, type: type}, function(err, data) {
|
||||
if ( err ) {
|
||||
console.log('Error occurred: ' + err);
|
||||
if ( err || data.error) {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
deferred.reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue