function normalizeError (err) {
	if (err instanceof Error) {
		return _.pickBy({
			message: err.message,
			stack: err.stack,
		}, val => !_.isEmpty(val));
	}

	if (err && err.status && err.response) {
		// this is probably a superagent error response. we definitely don't
		// want to log the whole thing
		return {
			response: {
				status: err.status,
				responseText: _.truncate(_.trimStart(err.response ? err.response.text : "<no response body>"), 200),
			},
		}
	}

	return err;
}
function normalizeError (err) {
	if (err instanceof Error) {
		return _.pickBy({
			message: err.message,
			stack: err.stack,
		}, val => !_.isEmpty(val));
	}

	if (err && err.status && err.response) {
		
		
		return {
			response: {
				status: err.status,
				responseText: _.truncate(_.trimStart(err.response ? err.response.text : "<no response body>"), 200),
			},
		}
	}

	return err;
}
function normalizeError ( err ) { if ( err instanceof Error ) { return _ . pickBy ( { message : err . message , stack : err . stack , } , val => ! _ . isEmpty ( val ) ) ; } if ( err && err . status && err . response ) { // this is probably a superagent error response. we definitely don't // want to log the whole thing return { response : { status : err . status , responseText : _ . truncate ( _ . trimStart ( err . response ? err . response . text : "<no response body>" ) , 200 ) , } , } } return err ; }
massage the error into a format suitable for logging
massage the error into a format suitable for logging