Major Features: - Multi-source download system (Soulseek/Lidarr with fallback) - Configurable enrichment speed control (1-5x) - Mobile touch drag support for seek sliders - iOS PWA media controls (Control Center, Lock Screen) - Artist name alias resolution via Last.fm - Circuit breaker pattern for audio analysis Critical Fixes: - Audio analyzer stability (non-ASCII, BrokenProcessPool, OOM) - Discovery system race conditions and import failures - Radio decade categorization using originalYear - LastFM API response normalization - Mood bucket infinite loop prevention Security: - Bull Board admin authentication - Lidarr webhook signature verification - JWT token expiration and refresh - Encryption key validation on startup Closes #2, #6, #9, #13, #21, #26, #31, #34, #35, #37, #40, #43
75 lines
2.4 KiB
TypeScript
75 lines
2.4 KiB
TypeScript
"use client";
|
|
|
|
import React, { Component, ReactNode } from "react";
|
|
|
|
interface Props {
|
|
children: ReactNode;
|
|
}
|
|
|
|
interface State {
|
|
hasError: boolean;
|
|
error: Error | null;
|
|
}
|
|
|
|
/**
|
|
* Global error boundary for catching application-level errors.
|
|
* Provides a fallback UI when critical errors occur in production.
|
|
*/
|
|
export class GlobalErrorBoundary extends Component<Props, State> {
|
|
constructor(props: Props) {
|
|
super(props);
|
|
this.state = { hasError: false, error: null };
|
|
}
|
|
|
|
static getDerivedStateFromError(error: Error): State {
|
|
return { hasError: true, error };
|
|
}
|
|
|
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
|
console.error("[GlobalErrorBoundary] Application error:", error);
|
|
console.error(
|
|
"[GlobalErrorBoundary] Component stack:",
|
|
errorInfo.componentStack
|
|
);
|
|
}
|
|
|
|
private handleReload = () => {
|
|
window.location.reload();
|
|
};
|
|
|
|
render() {
|
|
if (this.state.hasError) {
|
|
return (
|
|
<div className="min-h-screen flex items-center justify-center bg-gray-950 text-white p-4">
|
|
<div className="max-w-md w-full text-center space-y-6">
|
|
<div className="space-y-2">
|
|
<h1 className="text-2xl font-bold">
|
|
Something went wrong
|
|
</h1>
|
|
<p className="text-gray-400">
|
|
An unexpected error occurred. Please try
|
|
reloading the page.
|
|
</p>
|
|
</div>
|
|
{this.state.error && (
|
|
<div className="bg-gray-900 p-4 rounded-lg text-left">
|
|
<p className="text-sm font-mono text-red-400 break-words">
|
|
{this.state.error.message}
|
|
</p>
|
|
</div>
|
|
)}
|
|
<button
|
|
onClick={this.handleReload}
|
|
className="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-6 rounded-lg transition-colors"
|
|
>
|
|
Reload Page
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return this.props.children;
|
|
}
|
|
}
|