How to use the @loki/core.parseError function in @loki/core

To help you get started, we’ve selected a few @loki/core 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 oblador / loki / packages / target-chrome-aws-lambda / src / create-chrome-aws-lambda-target.js View on Github external
const invoke = withRetries(chromeAwsLambdaRetries, 1000)(async payload => {
    const lambda = new AWS.Lambda();

    const params = {
      FunctionName: chromeAwsLambdaFunctionName,
      Payload: JSON.stringify(payload),
    };

    debug(`Invoking ${params.FunctionName} with ${params.Payload}`);
    const data = await lambda.invoke(params).promise();
    const response = JSON.parse(data.Payload);
    if (response.errorMessage) {
      throw parseError(response.errorMessage);
    }
    return response;
  });