diff --git a/index.js b/index.js index a257725..2a8474c 100644 --- a/index.js +++ b/index.js @@ -64,16 +64,16 @@ module.exports = function ( app, options ) { uri: webmakerUrl + "user/" + id, json: true }, function ( error, response, body ) { - // User account wasn't found. Treat differently - if ( response.statusCode === 404 ) { - return callback(); - } - // Shallow error check if ( error ) { return callback( error ); } + // User account wasn't found. Treat differently + if ( response.statusCode === 404 ) { + return callback(); + } + // Deep error check if ( body && body.error ) { return callback( body.error );