From f81a588dc171eee459aea6dbffd03a1b31ab44d0 Mon Sep 17 00:00:00 2001 From: Disy Date: Tue, 20 Oct 2026 19:17:07 +0800 Subject: [PATCH] fix(ci): include skin site API error details in failures --- scripts/axolotl/publish-skin-site.mjs | 6 ++++-- scripts/axolotl/publish-skin-site.test.mjs | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/axolotl/publish-skin-site.mjs b/scripts/axolotl/publish-skin-site.mjs index 7287bfa..3283fa9 100644 --- a/scripts/axolotl/publish-skin-site.mjs +++ b/scripts/axolotl/publish-skin-site.mjs @@ -57,12 +57,14 @@ export async function publishSkinSite({ continue } if (!response.ok) { - await response.body?.cancel() + const details = await response.json().catch(() => null) if ((response.status === 429 || response.status >= 500) && attempt + 1 < attempts) { await sleep(500 * (attempt + 1)) continue } - throw new Error(`Skin site ${route}: HTTP ${response.status}`) + throw new Error( + `Skin site ${route}: HTTP ${response.status}${typeof details?.errorMessage === 'string' ? ` - ${details.errorMessage.slice(0, 1000)}` : ''}`, + ) } let result try { diff --git a/scripts/axolotl/publish-skin-site.test.mjs b/scripts/axolotl/publish-skin-site.test.mjs index 9f51f63..269cf26 100644 --- a/scripts/axolotl/publish-skin-site.test.mjs +++ b/scripts/axolotl/publish-skin-site.test.mjs @@ -170,3 +170,16 @@ test('CLI emits a GitHub error and exits nonzero when credentials are missing', assert.equal(result.status, 1) assert.match(result.stderr, /::error::.*SKIN_SITE_CI_UPLOAD_TOKEN/) }) + +test('reports structured server errors when creating the upload session fails', async (t) => { + const { archivePath } = await fixture(t) + await assert.rejects( + publishSkinSite( + settings(archivePath, { + fetch: async () => + Response.json({ errorMessage: 'Upload storage unavailable' }, { status: 500 }), + }), + ), + /HTTP 500 - Upload storage unavailable/, + ) +})