mirror of
https://github.com/zotero/zotero.git
synced 2026-09-24 00:51:37 +00:00
Read Aloud: Fix 402 handling
This commit is contained in:
parent
e2f33fbfe8
commit
fbdb7c1f30
1 changed files with 9 additions and 3 deletions
|
|
@ -672,8 +672,8 @@ Zotero.Sync.APIClient.prototype = {
|
|||
let method;
|
||||
let url;
|
||||
let options = {
|
||||
// Could be a blob (audio bytes) or an application/json envelope with `audioURL`
|
||||
// and `timestamps`; we inspect the Content-Type before parsing.
|
||||
// Could be audio bytes or a JSON { audioURL, timestamps } object
|
||||
// Inspect the Content-Type before parsing
|
||||
responseType: "arraybuffer",
|
||||
errorDelayMax: 8000,
|
||||
};
|
||||
|
|
@ -715,7 +715,13 @@ Zotero.Sync.APIClient.prototype = {
|
|||
|
||||
let error;
|
||||
if (e instanceof Zotero.HTTP.UnexpectedStatusException && e.status === 402) {
|
||||
let body = await e.xmlhttp.response?.text();
|
||||
let body = null;
|
||||
try {
|
||||
body = new TextDecoder().decode(e.xmlhttp.response);
|
||||
}
|
||||
catch {
|
||||
// Ignore
|
||||
}
|
||||
error = body === 'daily_limit_exceeded' ? 'daily-limit-exceeded' : 'quota-exceeded';
|
||||
}
|
||||
else if (e instanceof Zotero.HTTP.BrowserOfflineException) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue