Properly propagate 204 to fetchManifest
This commit is contained in:
parent
c857250b12
commit
b6287f4839
3 changed files with 25 additions and 7 deletions
|
@ -682,6 +682,11 @@ async function fetchManifest(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err.code === 204) {
|
||||||
|
log.info('storageService.fetchManifest: no newer manifest, ok');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
log.error(
|
log.error(
|
||||||
'storageService.fetchManifest: failed!',
|
'storageService.fetchManifest: failed!',
|
||||||
err && err.stack ? err.stack : String(err)
|
err && err.stack ? err.stack : String(err)
|
||||||
|
@ -691,10 +696,6 @@ async function fetchManifest(
|
||||||
await createNewManifest();
|
await createNewManifest();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (err.code === 204) {
|
|
||||||
// noNewerManifest we're ok
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,7 +423,12 @@ function doRecordsConflict(
|
||||||
|
|
||||||
// If both types are Long we can use Long's equals to compare them
|
// If both types are Long we can use Long's equals to compare them
|
||||||
if (Long.isLong(localValue) || typeof localValue === 'number') {
|
if (Long.isLong(localValue) || typeof localValue === 'number') {
|
||||||
if (!Long.isLong(remoteValue) || typeof remoteValue !== 'number') {
|
if (!Long.isLong(remoteValue) && typeof remoteValue !== 'number') {
|
||||||
|
log.info(
|
||||||
|
'storageService.doRecordsConflict: Conflict found, remote value ' +
|
||||||
|
'is not a number',
|
||||||
|
key
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1381,17 +1381,29 @@ export function initialize({
|
||||||
): Promise<Uint8Array> {
|
): Promise<Uint8Array> {
|
||||||
const { credentials, greaterThanVersion } = options;
|
const { credentials, greaterThanVersion } = options;
|
||||||
|
|
||||||
return _ajax({
|
const { data, response } = await _ajax({
|
||||||
call: 'storageManifest',
|
call: 'storageManifest',
|
||||||
contentType: 'application/x-protobuf',
|
contentType: 'application/x-protobuf',
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
httpType: 'GET',
|
httpType: 'GET',
|
||||||
responseType: 'bytes',
|
responseType: 'byteswithdetails',
|
||||||
urlParameters: greaterThanVersion
|
urlParameters: greaterThanVersion
|
||||||
? `/version/${greaterThanVersion}`
|
? `/version/${greaterThanVersion}`
|
||||||
: '',
|
: '',
|
||||||
...credentials,
|
...credentials,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (response.status === 204) {
|
||||||
|
throw makeHTTPError(
|
||||||
|
'promiseAjax: error response',
|
||||||
|
response.status,
|
||||||
|
response.headers.raw(),
|
||||||
|
data,
|
||||||
|
new Error().stack
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getStorageRecords(
|
async function getStorageRecords(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue