feat: add forgejo_error_reporter plugin for automatic error reporting to Forgejo issues

This commit is contained in:
Agent Zero
2026-07-26 12:49:39 +02:00
parent b9d05e2198
commit c3e41906bf
16 changed files with 608 additions and 14 deletions
+20
View File
@@ -0,0 +1,20 @@
export type ErrorCategory = 'network' | 'permission' | 'validation' | 'server' | 'auth' | 'unknown';
export interface CategorizedError {
category: ErrorCategory;
status: number;
message: string;
detail?: string;
code?: string;
field?: string;
}
export function categorizeError(error: any): CategorizedError {
const status = error?.status || 0;
if (status === 0) return { category: 'network', status: 0, message: 'Netzwerkfehler', detail: error?.message };
if (status === 401) return { category: 'auth', status, message: 'Nicht authentifiziert', detail: error?.detail };
if (status === 403) return { category: 'permission', status, message: 'Keine Berechtigung', detail: error?.detail };
if (status === 422) return { category: 'validation', status, message: 'Validierungsfehler', detail: error?.detail, field: error?.field };
if (status >= 500) return { category: 'server', status, message: 'Serverfehler', detail: error?.detail };
return { category: 'unknown', status, message: error?.message || 'Unbekannter Fehler', detail: error?.detail };
}