Improve resource loader error reporting and thumbnail uploads
All checks were successful
Build Org Website / build (push) Successful in 44s

This commit is contained in:
gitea-actions
2026-08-24 10:14:46 +01:00
parent 4653a2caae
commit 74924ea06f
5 changed files with 68 additions and 17 deletions

View File

@@ -107,10 +107,26 @@
els.syncStatus.querySelector("small").textContent = label;
}
async function responseError(response, prefix) {
let detail = "";
try {
const contentType = response.headers.get("Content-Type") || "";
if (contentType.includes("application/json")) {
const body = await response.json();
detail = body && body.message ? body.message : "";
} else {
detail = (await response.text()).trim().slice(0, 240);
}
} catch (_) {
detail = "";
}
return new Error(`${prefix} (${response.status})${detail ? `: ${detail}` : ""}`);
}
async function fetchServerLibrary() {
const response = await fetch(API_URL, { cache: "no-store", credentials: "same-origin" });
if (response.status === 404) return null;
if (!response.ok) throw new Error(`Server library request failed (${response.status}).`);
if (!response.ok) throw await responseError(response, "Server library request failed");
const library = Model.normaliseLibrary(await response.json());
state.serverEtag = response.headers.get("ETag");
return library;
@@ -128,7 +144,7 @@
headers: { "Content-Type": attachment.type || attachment.blob.type || "image/jpeg" },
body: attachment.blob,
});
if (!response.ok) throw new Error(`Thumbnail upload failed (${response.status}).`);
if (!response.ok) throw await responseError(response, "Thumbnail upload failed");
await deleteAttachment(id);
state.uploadedThumbnails.add(id);
}));
@@ -153,10 +169,13 @@
toast("Changes from another device were merged.");
return pushServerLibrary(merged, false);
}
if (!response.ok) throw new Error(`Server save failed (${response.status}).`);
if (!response.ok) throw await responseError(response, "Server save failed");
state.serverEtag = response.headers.get("ETag");
await uploadLocalThumbnails(library);
setSyncStatus("synced", "synced to server");
uploadLocalThumbnails(library).catch((error) => {
console.warn("Resource Loader metadata was saved, but a cover could not be uploaded.", error);
toast(`Saved to the server. Cover upload pending: ${error.message}`, true);
});
}
async function saveLibrary() {

View File

@@ -950,3 +950,34 @@ at <ScriptBlock>, /home/zaine/master-folder/org-platform/org_web/build-logs/gite
2026-08-20T14:04:37.8512952+01:00 [INFO] Running authoring server tests with /home/zaine/master-folder/org-platform/authoring-service/.venv/bin/python.
2026-08-20T14:04:37.9343738+01:00 [INFO] Authoring server tests passed: ran=0, failures=0, errors=0, skipped=0, exit=0
2026-08-20T14:04:38.2713260+01:00 [INFO] Sent authoring server test notification.
2026-08-20T14:19:48.5993450+01:00 [INFO] Prepared current build status for zaine/org_web: severity=Info, status=success
2026-08-20T14:19:48.6075666+01:00 [INFO] Fetching recent Gitea Actions runs for zaine/org_web.
2026-08-20T14:19:48.9599662+01:00 [ERROR] Failed to analyze job 843: Cannot bind argument to parameter 'LogText' because it is an empty string.
2026-08-20T14:19:49.5771097+01:00 [INFO] Sent build status notification with 1 embed(s).
2026-08-20T14:19:49.5967349+01:00 [INFO] Running authoring server tests with /home/zaine/master-folder/org-platform/authoring-service/.venv/bin/python.
2026-08-20T14:19:49.6733567+01:00 [INFO] Authoring server tests passed: ran=0, failures=0, errors=0, skipped=0, exit=0
2026-08-20T14:19:50.0076424+01:00 [INFO] Sent authoring server test notification.
2026-08-21T01:02:06.4972365+01:00 [INFO] Prepared current build status for zaine/org_web: severity=Info, status=success
2026-08-21T01:02:06.5049603+01:00 [INFO] Fetching recent Gitea Actions runs for zaine/org_web.
2026-08-21T01:02:07.3866825+01:00 [INFO] Sent build status notification with 1 embed(s).
2026-08-21T01:02:07.4073855+01:00 [INFO] Running authoring server tests with /home/zaine/master-folder/org-platform/authoring-service/.venv/bin/python.
2026-08-21T01:02:07.4841692+01:00 [INFO] Authoring server tests passed: ran=0, failures=0, errors=0, skipped=0, exit=0
2026-08-21T01:02:07.8213892+01:00 [INFO] Sent authoring server test notification.
2026-08-22T01:01:52.0344584+01:00 [INFO] Prepared current build status for zaine/org_web: severity=Info, status=success
2026-08-22T01:01:52.0428976+01:00 [INFO] Fetching recent Gitea Actions runs for zaine/org_web.
2026-08-22T01:01:52.8781493+01:00 [INFO] Sent build status notification with 1 embed(s).
2026-08-22T01:01:52.8986448+01:00 [INFO] Running authoring server tests with /home/zaine/master-folder/org-platform/authoring-service/.venv/bin/python.
2026-08-22T01:01:52.9796594+01:00 [INFO] Authoring server tests passed: ran=0, failures=0, errors=0, skipped=0, exit=0
2026-08-22T01:01:53.2844353+01:00 [INFO] Sent authoring server test notification.
2026-08-23T01:01:52.1862499+01:00 [INFO] Prepared current build status for zaine/org_web: severity=Info, status=success
2026-08-23T01:01:52.1951840+01:00 [INFO] Fetching recent Gitea Actions runs for zaine/org_web.
2026-08-23T01:01:53.0998809+01:00 [INFO] Sent build status notification with 1 embed(s).
2026-08-23T01:01:53.1220654+01:00 [INFO] Running authoring server tests with /home/zaine/master-folder/org-platform/authoring-service/.venv/bin/python.
2026-08-23T01:01:53.2055694+01:00 [INFO] Authoring server tests passed: ran=0, failures=0, errors=0, skipped=0, exit=0
2026-08-23T01:01:53.5671307+01:00 [INFO] Sent authoring server test notification.
2026-08-24T01:02:06.5023388+01:00 [INFO] Prepared current build status for zaine/org_web: severity=Info, status=success
2026-08-24T01:02:06.5112487+01:00 [INFO] Fetching recent Gitea Actions runs for zaine/org_web.
2026-08-24T01:02:07.5862361+01:00 [INFO] Sent build status notification with 1 embed(s).
2026-08-24T01:02:07.6056472+01:00 [INFO] Running authoring server tests with /home/zaine/master-folder/org-platform/authoring-service/.venv/bin/python.
2026-08-24T01:02:07.6978396+01:00 [INFO] Authoring server tests passed: ran=0, failures=0, errors=0, skipped=0, exit=0
2026-08-24T01:02:08.0418080+01:00 [INFO] Sent authoring server test notification.

View File

@@ -4,7 +4,7 @@
See the categories: @@html:<a href="../home/categories.html">Categories</a>@@
* Posts:
- [[file:career/career-list.org][Career List]] @@html:<span class="post-date">20-08-2026 14:04</span>@@
- [[file:career/career-list.org][Career List]] @@html:<span class="post-date">24-08-2026 10:11</span>@@
- [[file:career/cross-site-scripting-xss.org][Cross-Site Scripting (XSS)]] @@html:<span class="post-date">01-06-2026 10:21</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
- [[file:career/ha-dr.org][High Availability, Disaster Recovery and Business Continuity]] @@html:<span class="post-date">11-03-2026 17:18</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
- [[file:career/javascript.org][Understands the Javascript language]] @@html:<span class="post-date">11-03-2026 16:52</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@

View File

@@ -4,6 +4,7 @@
#+DATE: <2026-08-19 Wed>
#+BEGIN_EXPORT html
<!-- Resource Loader metadata is server-authoritative; keep this shell revision aligned with its page script. -->
<main class="rl-app" id="resource-loader" aria-labelledby="rl-title">
<header class="rl-hero">
<div class="rl-hero__copy">

View File

@@ -78,19 +78,19 @@ flowchart TD
n30 --> n36
n37["Tag: website"]
n30 --> n37
n38["Tag: life"]
n38["Tag: update"]
n30 --> n38
n39["Tag: education"]
n39["Tag: life"]
n30 --> n39
n40["Tag: update"]
n40["Tag: education"]
n30 --> n40
n41["Tag: insights"]
n30 --> n41
n42["Tag: emacs"]
n30 --> n42
n43["Tag: maths"]
n43["Tag: reading"]
n30 --> n43
n44["Tag: reading"]
n44["Tag: maths"]
n30 --> n44
n45{{"posts"}}
root --> n45
@@ -211,13 +211,13 @@ flowchart TD
click n35 "tags/notes.html" "Tag: notes"
click n36 "tags/review.html" "Tag: review"
click n37 "tags/website.html" "Tag: website"
click n38 "tags/life.html" "Tag: life"
click n39 "tags/education.html" "Tag: education"
click n40 "tags/update.html" "Tag: update"
click n38 "tags/update.html" "Tag: update"
click n39 "tags/life.html" "Tag: life"
click n40 "tags/education.html" "Tag: education"
click n41 "tags/insights.html" "Tag: insights"
click n42 "tags/emacs.html" "Tag: emacs"
click n43 "tags/maths.html" "Tag: maths"
click n44 "tags/reading.html" "Tag: reading"
click n43 "tags/reading.html" "Tag: reading"
click n44 "tags/maths.html" "Tag: maths"
click n46 "posts/posts-intro.html" "Posts Introduction"
click n47 "posts/posts-list.html" "Posts List"
click n49 "posts/career/solid-principles.html" "SOLID Principles"
@@ -301,13 +301,13 @@ flowchart TD
- [[file:tags/notes.org][Tag: notes]]
- [[file:tags/review.org][Tag: review]]
- [[file:tags/website.org][Tag: website]]
- [[file:tags/update.org][Tag: update]]
- [[file:tags/life.org][Tag: life]]
- [[file:tags/education.org][Tag: education]]
- [[file:tags/update.org][Tag: update]]
- [[file:tags/insights.org][Tag: insights]]
- [[file:tags/emacs.org][Tag: emacs]]
- [[file:tags/maths.org][Tag: maths]]
- [[file:tags/reading.org][Tag: reading]]
- [[file:tags/maths.org][Tag: maths]]
- posts
- [[file:posts/posts-intro.org][Posts Introduction]]
- [[file:posts/posts-list.org][Posts List]]