mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Nostr git improve error reporting for push
This commit is contained in:
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
@@ -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}`);
|
||||
|
||||
Reference in new issue
Block a user