How to use the boom.gatewayTimeout function in boom

To help you get started, we’ve selected a few boom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / x-pack / plugins / code / server / utils / timeout.ts View on Github external
export function promiseTimeout(ms: number, promise: Promise): Promise {
  const boom = Boom.gatewayTimeout('Timed out in ' + ms + 'ms.');
  // @ts-ignore
  boom.isTimeout = true;

  if (ms > 0) {
    // Create a promise that rejects in 
github elastic / kibana / kibana-extra / code / server / utils / timeout.ts View on Github external
const id = setTimeout(() => {
      clearTimeout(id);
      const boom = Boom.gatewayTimeout('Timed out in ' + ms + 'ms.');
      // @ts-ignore
      boom.isTimeout = true;
      reject(boom);
    }, ms);
  });
github JKHeadley / rest-hapi / utilities / error-helper.js View on Github external
formatResponse: function(error, Log) {
    try {
      var response = {};
      if (error.type) {
        switch (error.type) {
          case this.types.BAD_IMPLEMENTATION:
            response = Boom.badImplementation(error.message);
            break;
          case this.types.GATEWAY_TIMEOUT:
            response = Boom.gatewayTimeout(error.message);
            break;
          case this.types.NOT_FOUND:
            response = Boom.notFound(error.message);
            break;
          case this.types.BAD_REQUEST:
            response = Boom.badRequest(error.message);
            break;
          case this.types.CONFLICT:
            response = Boom.conflict(error.message);
            break;
          default:
            response = Boom.badRequest(error.message);
        }
      }
      else if (error.isBoom) {
        response = error
github JKHeadley / appy-backend / server / api / register.js View on Github external
.catch(function (error) {
          Log.error(error);
          return reply(Boom.gatewayTimeout('An error occurred.'));
        });
    };
github JKHeadley / rest-hapi / api / utilities_sequelize / handler-helper-factory.js View on Github external
}).catch(function (error) {
          Log.error(error);
          reply(Boom.gatewayTimeout("There was a database error while retrieving the owner resource."));
        });
      }
github hapijs / hapi / lib / client.js View on Github external
timeoutId = setTimeout(function () {

            return finish(Boom.gatewayTimeout('Client request timeout'));
        }, options.timeout);
    }
github elastic / kibana / src / legacy / core_plugins / console / server / request.ts View on Github external
setTimeout(() => {
      if (!req.aborted && !req.socket) req.abort();
      if (!resolved) {
        timeoutReject(Boom.gatewayTimeout('Client request timeout'));
      } else {
        timeoutResolve();
      }
    }, timeout);
  });
github JKHeadley / appy-backend / server / api / register.js View on Github external
.catch(function (error) {
                Log.error('sending welcome email failed:', error);
                return reply(Boom.gatewayTimeout('Sending registration email failed.'));
              });
          }
github secreter / puppeteer-screenshot / src / controller / index.js View on Github external
let params=ctx.request.body
  let options={
      url:params.url,
      screenshot:params.screenshot,
      html:params.html,
      style:params.style,
      script:params.script,
      waitFor:params.waitFor,
      device:params.device
  }
  if(!(options=checkOption(options,ctx))) return
  ctx.type = options.screenshot.type;
  try{
      ctx.body=await instance.getImage(options)
  }catch (e) {
      ctx.body=Boom.gatewayTimeout(e.message||'Service Unavailable').output;
  }
}
github secreter / puppeteer-screenshot / src / controller / index.js View on Github external
x:ctx.query.x,
        y:ctx.query.y,
        width:ctx.query.w,
        height:ctx.query.h,
      },
      omitBackground:ctx.query.o
    },
    waitFor:ctx.query.waitFor,
    device:ctx.query.device
  }
  if(!(options=checkOption(options,ctx))) return
  ctx.type = options.screenshot.type;
  try{
    ctx.body=await instance.getImage(options)
  }catch (e) {
    ctx.body=Boom.gatewayTimeout(e.message||'Service Unavailable').output;
  }
}