lib/responses.js
function expectText(fn, res) {
  bluebird.try(fn).then(result => {
    res.set('Content-Type', 'text/plain');
    res.send(result);
  }).catch(handleError(res));
}
function expectText(fn, res) {
  bluebird.try(fn).then(result => {
    res.set('Content-Type', 'text/plain');
    res.send(result);
  }).catch(handleError(res));
}
function expectText ( fn , res ) { bluebird . try ( fn ) . then ( result => { res . set ( 'Content-Type' , 'text/plain' ) ; res . send ( result ) ; } ) . catch ( handleError ( res ) ) ; }
Reusable code to return Text data, both for good results AND errors.

Captures and hides appropriate errors.

@param {function} fn
@param {object} res
Reusable code to return Text data both for good results AND errors .