lib/registry-client-v2.js
function _getRegistryErrorMessage(err) {
    if (err.body && Array.isArray(err.body.errors) && err.body.errors[0]) {
        return err.body.errors[0].message;
    } else if (err.body && err.body.details) {
        return err.body.details;
    } else if (Array.isArray(err.errors) && err.errors[0].message) {
        return err.errors[0].message;
    } else if (err.message) {
        return err.message;
    }
    return err.toString();
}
function _getRegistryErrorMessage(err) {
    if (err.body && Array.isArray(err.body.errors) && err.body.errors[0]) {
        return err.body.errors[0].message;
    } else if (err.body && err.body.details) {
        return err.body.details;
    } else if (Array.isArray(err.errors) && err.errors[0].message) {
        return err.errors[0].message;
    } else if (err.message) {
        return err.message;
    }
    return err.toString();
}
function _getRegistryErrorMessage ( err ) { if ( err . body && Array . isArray ( err . body . errors ) && err . body . errors [ 0 ] ) { return err . body . errors [ 0 ] . message ; } else if ( err . body && err . body . details ) { return err . body . details ; } else if ( Array . isArray ( err . errors ) && err . errors [ 0 ] . message ) { return err . errors [ 0 ] . message ; } else if ( err . message ) { return err . message ; } return err . toString ( ) ; }
Special handling of errors from the registry server.

Some registry errors will use a custom error format, so detect those
and convert these as necessary.

Example JSON response for a missing repo:
{
"jse_shortmsg": "",
"jse_info": {},
"message": "{\"errors\":[{\"code\":\"UNAUTHORIZED\",\"message\":\"...}\n",
"body": {
"errors": [{
"code": "UNAUTHORIZED",
"message": "authentication required",
"detail": [{
"Type": "repository",
"Class": "",
"Name": "library/idontexist",
"Action": "pull"
}]
}]
}
}

Example JSON response for bad username/password:
{
"statusCode": 401,
"jse_shortmsg":"",
"jse_info":{},
"message":"{\"details\":\"incorrect username or password\"}\n",
"body":{
"details": "incorrect username or password"
}
}

Example AWS token error:
{
"statusCode": 400,
"errors": [
{
"code": "DENIED",
"message": "Your Authorization Token is invalid."
}
]
}
Special handling of errors from the registry server .