Nostr git improve error reporting for push

This commit is contained in:
Alex Gleason committed 2025-12-28 23:38:22 -06:00
1 parent 5691954dc8
commit d8e46732b3
2 files changed
+16 -6

No files matched your search

@@ -157,7 +157,9 @@ export function SyncStepError({ error, onDismiss, onForcePull, onForcePush, onPu
return (
<Alert variant="destructive">
<div className="flex items-start justify-between gap-2">
<AlertDescription className="text-sm flex-1">{error.message}</AlertDescription>
<AlertDescription className="text-sm flex-1 whitespace-pre overflow-x-auto">
{error.message}
</AlertDescription>
{renderDismissButton()}
</div>
</Alert>
+13 -5
View File
@@ -885,7 +885,15 @@ export class Git {
throw new Error('Repository not found on Nostr network');
}
const cloneUrls = repo.tags.find(([name]) => name === 'clone')?.slice(1) ?? [];
const cloneUrls = (repo.tags.find(([name]) => name === 'clone')?.slice(1) ?? [])
.map((url) => {
try {
return new URL(url);
} catch {
return null;
}
})
.filter((url): url is URL => url !== null);
if (cloneUrls.length === 0) {
throw new Error('No clone URLs found in repository announcement');
@@ -980,9 +988,9 @@ export class Git {
git.push({
...options,
fs: this.fs,
http: this.httpForUrl(url),
http: this.httpForUrl(url.href),
onAuth: this.onAuth,
url,
url: url.href,
dir,
}),
])
@@ -999,9 +1007,9 @@ export class Git {
if (result.status === 'rejected') {
const error = result.reason;
const errorMessage = error instanceof Error ? error.message : String(error);
return ` - ${url}: ${errorMessage}`;
return ` - ${url.host}: ${errorMessage}`;
}
return ` - ${url}: Unknown error`;
return ` - ${url.host}: Unknown error`;
}).join('\n');
throw new Error(`Failed to push to any clone URLs:\n${errorDetails}`);