Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

How to retry only critical errors? #944

Open
Astimus opened this issue Dec 5, 2018 · 1 comment
Open

How to retry only critical errors? #944

Astimus opened this issue Dec 5, 2018 · 1 comment

Comments

@Astimus
Copy link

Astimus commented Dec 5, 2018

Hello.
Right now retry works on critical errors and on failed diff. How to retry only on critical errors? Is there any workaround?

@unekhriukova
Copy link

unekhriukova commented Jan 14, 2019

I have the same question. I tried to make a workaround by emitting the Events.RETRY event, but that does not work. Maybe, guys, you can give some advice on that also.

'use strict';

const Gemini = require('gemini/api');
const Events = require('gemini/lib/constants/events');
const handleErrors = require('gemini/lib/cli/errors').handleErrors;

class GeminiCi {
  constructor() {
    let gemini = new Gemini();
    gemini.on(Events.ERROR, (err) => {
      if( err.name === 'GeminiError' ) {
        process.exit(handleErrors(err));
      } else {
        gemini.emit(Events.RETRY, Object.assign(err, {attempt: 0, retriesLeft: 1}));
      }
    });
    return gemini.test([], { reporters: [{ name: 'flat' }]})
      .then(stats => stats.failed > 0 ? 1 : 0);
  }
}

new GeminiCi();

"gemini": "5.9.1"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants