Skip to content

Commit

Permalink
fix after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Jun 22, 2020
1 parent 074b693 commit ff1b811
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/util/http/index.spec.ts
@@ -1,6 +1,6 @@
import nock from 'nock';
import { getName } from '../../../test/util';
import { DATASOURCE_FAILURE } from '../../constants/error-messages';
import { EXTERNAL_HOST_ERROR } from '../../constants/error-messages';
import * as hostRules from '../host-rules';
import { Http } from '.';

Expand All @@ -26,12 +26,12 @@ describe(getName(__filename), () => {
);
expect(nock.isDone()).toBe(true);
});
it('converts 429 error to DatasourceError', async () => {
it('converts 429 error to ExternalHostError', async () => {
nock(baseUrl).get('/test').reply(429);
// TODO: set abortStatusCodes default value
hostRules.add({ abortOnError: true, abortStatusCodes: [429] });
await expect(http.get('http://renovate.com/test')).rejects.toThrow(
DATASOURCE_FAILURE
EXTERNAL_HOST_ERROR
);
expect(nock.isDone()).toBe(true);
});
Expand Down
4 changes: 2 additions & 2 deletions lib/util/http/index.ts
@@ -1,7 +1,7 @@
import crypto from 'crypto';
import URL from 'url';
import got from 'got';
import { DatasourceError } from '../../datasource';
import { ExternalHostError } from '../../types/error';
import * as runCache from '../cache/run';
import { clone } from '../clone';
import { applyAuthorization } from './auth';
Expand Down Expand Up @@ -127,7 +127,7 @@ export class Http<GetOptions = HttpOptions, PostOptions = HttpPostOptions> {
options.abortOnError &&
options.abortStatusCodes?.includes(err.statusCode)
) {
throw new DatasourceError(err);
throw new ExternalHostError(err);
}
throw err;
}
Expand Down

0 comments on commit ff1b811

Please sign in to comment.