mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 19:26:33 +00:00
fix(s3): Fix EAI_AGAIN error at startup with no internet connection (#1855)
Change-type: patch
This commit is contained in:
parent
66cb7293e7
commit
701893b472
@ -160,6 +160,8 @@ exports.getRemoteVersions = _.memoize((bucketUrl) => {
|
||||
}, {
|
||||
code: 'EHOSTDOWN'
|
||||
}, {
|
||||
code: 'EAI_AGAIN'
|
||||
}, {
|
||||
|
||||
// May happen when behind a proxy
|
||||
code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
|
||||
|
@ -649,6 +649,28 @@ describe('Shared: s3Packages', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('given EAI_AGAIN', function () {
|
||||
beforeEach(function () {
|
||||
const error = new Error('EAI_AGAIN')
|
||||
error.code = 'EAI_AGAIN'
|
||||
|
||||
this.requestGetAsyncStub = m.sinon.stub(request, 'getAsync')
|
||||
this.requestGetAsyncStub.returns(Bluebird.reject(error))
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
this.requestGetAsyncStub.restore()
|
||||
})
|
||||
|
||||
it('should be rejected with a user error with code UPDATE_USER_ERROR', function (done) {
|
||||
s3Packages.getRemoteVersions(s3Packages.BUCKET_URL.PRODUCTION).catch((error) => {
|
||||
m.chai.expect(errors.isUserError(error)).to.be.true
|
||||
m.chai.expect(error.code).to.equal('UPDATE_USER_ERROR')
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('given ECONNRESET', function () {
|
||||
beforeEach(function () {
|
||||
const error = new Error('ECONNRESET')
|
||||
|
Loading…
x
Reference in New Issue
Block a user