Faro & grafana improvements
Run Tests on Branches / Detect Changes (push) Successful in 8s
Run Tests on Branches / Backend Tests (push) Has been skipped
Run Tests on Branches / Frontend Tests (push) Successful in 1m46s
Run Tests on Branches / Frontend Mobile Tests (push) Has been cancelled

This commit is contained in:
Antoni Nuñez Romeu
2026-07-07 23:40:04 +02:00
parent aae3ac04af
commit 6612c8b10c
5 changed files with 99 additions and 13 deletions
@@ -0,0 +1,57 @@
import React from 'react';
export default class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false, error: null };
}
static getDerivedStateFromError(error) {
return { hasError: true, error };
}
componentDidCatch(error, info) {
// Report to Faro if available
try {
const faro = window.__faro;
if (faro?.api?.pushError) {
faro.api.pushError(error, { type: 'react-boundary', componentStack: info.componentStack });
}
} catch {
// Faro reporting must never break the app
}
console.error('[ErrorBoundary]', error, info);
}
render() {
if (this.state.hasError) {
return (
<div style={{
padding: '2rem',
textAlign: 'center',
fontFamily: 'system-ui, sans-serif',
color: '#333',
}}>
<h2>Algo salió mal</h2>
<p style={{ color: '#666' }}>Ha ocurrido un error inesperado. Por favor, recarga la página.</p>
<button
onClick={() => window.location.reload()}
style={{
marginTop: '1rem',
padding: '0.5rem 1.5rem',
backgroundColor: '#27633a',
color: '#fff',
border: 'none',
borderRadius: '6px',
cursor: 'pointer',
fontSize: '1rem',
}}
>
Recargar
</button>
</div>
);
}
return this.props.children;
}
}