complete performance and reliability follow-ups
This commit is contained in:
@@ -170,7 +170,8 @@ export const UPLOAD_RUNTIME = `
|
||||
});
|
||||
xhr.addEventListener("load", function () {
|
||||
var data = null;
|
||||
try { data = JSON.parse(xhr.responseText); } catch (e2) {}
|
||||
try { data = JSON.parse(xhr.responseText); }
|
||||
catch (error) { console.warn("[wrnexus:uploader] upload response was not valid JSON", error); }
|
||||
if (xhr.status >= 200 && xhr.status < 300 && data && data.ok) {
|
||||
done(ui, (data.files && data.files[0]) || null, file);
|
||||
} else {
|
||||
|
||||
@@ -11,6 +11,12 @@ import {
|
||||
upload,
|
||||
verifySignedFileToken,
|
||||
} from "../src/index.ts";
|
||||
import { UPLOAD_RUNTIME } from "../src/runtime.ts";
|
||||
|
||||
test("browser upload response parse failures emit a diagnostic", () => {
|
||||
expect(UPLOAD_RUNTIME).toContain("upload response was not valid JSON");
|
||||
expect(UPLOAD_RUNTIME).not.toContain("catch (e2) {}");
|
||||
});
|
||||
|
||||
function configure() {
|
||||
configureStorage(
|
||||
|
||||
Reference in New Issue
Block a user