From e3e500ccc279deaa4d4b72b42a2432f1c05fb228 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Mon, 10 Nov 2025 16:02:02 -0800 Subject: [PATCH] Return better blossom errors --- src/app/core/commands.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/core/commands.ts b/src/app/core/commands.ts index 128f27d1..f33182c0 100644 --- a/src/app/core/commands.ts +++ b/src/app/core/commands.ts @@ -612,7 +612,7 @@ export const payInvoice = async (invoice: string) => { export const normalizeBlossomUrl = (url: string) => normalizeUrl(url.replace(/^ws/, "http")) -export const hasBlossomSupport = simpleCache(async ([url]: [string]) => { +export const fetchHasBlossomSupport = async (url: string) => { const server = normalizeBlossomUrl(url) const $signer = signer.get() || Nip01Signer.ephemeral() const headers: Record = { @@ -633,7 +633,9 @@ export const hasBlossomSupport = simpleCache(async ([url]: [string]) => { } return false -}) +} + +export const hasBlossomSupport = simpleCache(([url]: [string]) => fetchHasBlossomSupport(url)) export type GetBlossomServerOptions = { url?: string @@ -701,7 +703,7 @@ export const uploadFile = async (file: File, options: UploadFileOptions = {}) => let {uploaded, url, ...task} = parseJson(text) || {} if (!uploaded) { - return {error: text} + return {error: text || `Failed to upload file (HTTP ${res.status})`} } // Always append correct file extension if we encrypted the file, or if it's missing