function _errorActions(err, errorDocument, routingRules,
    bucket, objectKey, corsHeaders, request, log, callback) {
    const bucketName = bucket.getName();
    const errRoutingRule = findRoutingRule(routingRules,
        objectKey, err.code);
    if (errRoutingRule) {
        // route will redirect
        const action = request.method === 'HEAD' ? 'headObject' : 'getObject';
        monitoring.promMetrics(
            request.method, bucketName, err.code, action);
        return callback(err, false, null, corsHeaders, errRoutingRule,
            objectKey);
    }
    if (request.method === 'HEAD') {
        monitoring.promMetrics(
            'HEAD', bucketName, err.code, 'headObject');
        return callback(err, false, null, corsHeaders);
    }
    if (errorDocument) {
        return metadata.getObjectMD(bucketName, errorDocument, {}, log,
            (errObjErr, errObjMD) => {
                if (errObjErr) {
                    // error retrieving error document so return original error
                    // and set boolean of error retrieving user's error document
                    // to true
                    monitoring.promMetrics(
                        'GET', bucketName, err.code, 'getObject');
                    return callback(err, true, null, corsHeaders);
                }
                // return the default error message if the object is private
                // rather than sending a stored error file
                // eslint-disable-next-line no-param-reassign
                request.objectKey = errorDocument;
                if (!isObjAuthorized(bucket, errObjMD, request.apiMethods || 'objectGet',
                    constants.publicId, null, log, request, request.actionImplicitDenies, true)) {
                    log.trace('errorObj not authorized', { error: err });
                    monitoring.promMetrics(
                        'GET', bucketName, err.code, 'getObject');
                    return callback(err, true, null, corsHeaders);
                }
                const dataLocator = errObjMD.location;
                if (errObjMD['x-amz-server-side-encryption']) {
                    for (let i = 0; i < dataLocator.length; i++) {
                        dataLocator[i].masterKeyId =
                            errObjMD['x-amz-server-side-encryption-aws-' +
                                'kms-key-id'];
                        dataLocator[i].algorithm =
                            errObjMD['x-amz-server-side-encryption'];
                    }
                }

                if (errObjMD['x-amz-website-redirect-location']) {
                    const redirectLocation =
                        errObjMD['x-amz-website-redirect-location'];
                    const redirectInfo = { withError: true,
                        location: redirectLocation };
                    log.trace('redirecting to x-amz-website-redirect-location',
                        { location: redirectLocation });
                    return callback(err, false, dataLocator, corsHeaders,
                        redirectInfo, '');
                }

                const responseMetaHeaders = collectResponseHeaders(errObjMD,
                    corsHeaders);
                pushMetric('getObject', log, {
                    bucket: bucketName,
                    newByteLength: responseMetaHeaders['Content-Length'],
                });
                monitoring.promMetrics(
                    'GET', bucketName, err.code, 'getObject');
                return callback(err, false, dataLocator, responseMetaHeaders);
            });
    }
    monitoring.promMetrics(
        'GET', bucketName, err.code, 'getObject');
    return callback(err, false, null, corsHeaders);
}
_errorActions - take a number of actions once have error getting obj
@param {object} err - arsenal errors object
@param {string} errorDocument - key to get error document
@param {object []} routingRules - array of routingRule objects
@param {object} bucket - bucket metadata
@param {string} objectKey - object key from request (or as translated in
website)
@param {object} corsHeaders - CORS-related response headers
@param {object} request - normalized request object
@param {object} log - Werelogs instance
@param {function} callback - callback to function in route
@return {undefined}