mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
fix(GUI): catch EACCES when querying S3 packages (#1463)
When the user is behind a firewall, then the HTTP request to query the latest available version from S3 may throw an EACCES error, eventually causing a confusin "You don't have access to this resource" error window. Change-Type: patch Changelog-Entry: Fix "You don't have access to this resource" error at startup when behind a firewall. Fixes: https://github.com/resin-io/etcher/issues/1458 Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This commit is contained in:
parent
78f36dfd16
commit
705e273400
@ -152,6 +152,8 @@ exports.getRemoteVersions = _.memoize((bucketUrl) => {
|
||||
code: 'ECONNRESET'
|
||||
}, {
|
||||
code: 'ECONNREFUSED'
|
||||
}, {
|
||||
code: 'EACCES'
|
||||
}, {
|
||||
code: 'ETIMEDOUT'
|
||||
}, () => {
|
||||
|
@ -689,6 +689,29 @@ describe('Shared: s3Packages', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('given EACCES', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
const error = new Error('EACCES');
|
||||
error.code = 'EACCES';
|
||||
|
||||
this.requestGetAsyncStub = m.sinon.stub(request, 'getAsync');
|
||||
this.requestGetAsyncStub.returns(Bluebird.reject(error));
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
this.requestGetAsyncStub.restore();
|
||||
});
|
||||
|
||||
it('should resolve an empty array', function(done) {
|
||||
s3Packages.getRemoteVersions(s3Packages.BUCKET_URL.PRODUCTION).then((versions) => {
|
||||
m.chai.expect(versions).to.deep.equal([]);
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('.getLatestVersion()', function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user