## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/14664226456> > Commit: caaee4bf1801f63845044e1d0870fd50e853bf3a > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14664226456&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Fri, 25 Apr 2025 13:20:56 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Unified all error and telemetry reporting to use a centralized telemetry utility for improved consistency. - Replaced legacy error reporting imports and methods with a new singleton telemetry interface across the application. - Removed obsolete telemetry and error reporting files and classes. - Simplified telemetry initialization by removing conditional tracing checks. - No changes to user-facing functionality or workflows. - **Tests** - Updated test mocks to use the new telemetry interface. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
import React, { Component } from "react";
|
|
import styled from "styled-components";
|
|
import AppCrashImage from "assets/images/404-image.png";
|
|
import log from "loglevel";
|
|
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
|
import { Button } from "@appsmith/ads";
|
|
import { appsmithTelemetry } from "instrumentation";
|
|
|
|
const Wrapper = styled.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
height: calc(100vh - ${(props) => props.theme.headerHeight});
|
|
.bold-text {
|
|
font-weight: ${(props) => props.theme.fontWeights[3]};
|
|
font-size: 24px;
|
|
}
|
|
.page-unavailable-img {
|
|
width: 35%;
|
|
}
|
|
.button-position {
|
|
margin: auto;
|
|
}
|
|
`;
|
|
|
|
class AppErrorBoundary extends Component {
|
|
state = {
|
|
hasError: false,
|
|
};
|
|
|
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
|
log.error({ error, errorInfo });
|
|
appsmithTelemetry.captureException(error, {
|
|
errorName: "AppErrorBoundary",
|
|
});
|
|
AnalyticsUtil.logEvent("APP_CRASH", { error, errorInfo });
|
|
this.setState({
|
|
hasError: true,
|
|
});
|
|
}
|
|
|
|
render() {
|
|
if (this.state.hasError) {
|
|
return (
|
|
<Wrapper>
|
|
<img alt="App crashed" src={AppCrashImage} />
|
|
<div>
|
|
<p className="bold-text">Oops! Something went wrong</p>
|
|
<p>
|
|
Please try again using the button below. <br />
|
|
If the issue persists, please contact us
|
|
</p>
|
|
<br />
|
|
<Button onClick={() => window.location.reload()} size="md">
|
|
Retry
|
|
</Button>
|
|
</div>
|
|
</Wrapper>
|
|
);
|
|
}
|
|
|
|
return this.props.children;
|
|
}
|
|
}
|
|
|
|
export default AppErrorBoundary;
|