Skip to content

Commit 3e21102

Browse files
committed
[dashboard] unify error reporting
move error boundary to general error reporting endpoint as well
1 parent 352484b commit 3e21102

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

components/dashboard/src/components/error-boundaries/ReloadPageErrorBoundary.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
*/
66

77
import { FC, useCallback } from "react";
8-
import { ErrorBoundary, FallbackProps, ErrorBoundaryProps } from "react-error-boundary";
8+
import { ErrorBoundary, ErrorBoundaryProps, FallbackProps } from "react-error-boundary";
99
import gitpodIcon from "../../icons/gitpod.svg";
10-
import { getGitpodService } from "../../service/service";
1110
import { Heading1, Subheading } from "../typography/headings";
11+
import { reportError } from "../../service/metrics";
1212

1313
export type CaughtError = Error & { code?: number };
1414

@@ -64,11 +64,4 @@ export const ReloadPageErrorFallback: FC<Pick<FallbackProps, "error">> = ({ erro
6464
);
6565
};
6666

67-
export const handleError: ErrorBoundaryProps["onError"] = async (error, info) => {
68-
const url = window.location.toString();
69-
try {
70-
await getGitpodService().server.reportErrorBoundary(url, error.message || "Unknown Error");
71-
} catch (e) {
72-
console.error(e);
73-
}
74-
};
67+
export const handleError: ErrorBoundaryProps["onError"] = (error, info) => reportError("Error boundary", error, info);

components/dashboard/src/service/metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ console.error = function (...args) {
4040
reportError(...args);
4141
};
4242

43-
function reportError(...args: any[]) {
43+
export function reportError(...args: any[]) {
4444
let err = undefined;
4545
let details = undefined;
4646
if (args[0] instanceof Error) {

components/server/src/workspace/gitpod-server-impl.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,6 +3464,10 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
34643464
//
34653465
//#endregion
34663466

3467+
/**
3468+
* TODO(ak)
3469+
* @deprecated remove it after dashboard is deployed. It was replaced with error reporting in GCP.
3470+
*/
34673471
async reportErrorBoundary(ctx: TraceContextWithSpan, url: string, message: string): Promise<void> {
34683472
// Cap message and url length so the entries aren't of unbounded length
34693473
log.warn("dashboard error boundary", {

0 commit comments

Comments
 (0)