diff --git a/website/agb/src/app/crash/debug.tsx b/website/agb/src/app/crash/debug.tsx index 4e33ce98..5e036640 100644 --- a/website/agb/src/app/crash/debug.tsx +++ b/website/agb/src/app/crash/debug.tsx @@ -1,6 +1,6 @@ import { styled } from "styled-components"; import { AddressInfo, AgbDebug, useAgbDebug } from "../useAgbDebug.hook"; -import { useMemo, useState } from "react"; +import { ReactNode, useMemo, useState } from "react"; const BacktraceListWrapper = styled.div` font-size: 1rem; @@ -41,8 +41,15 @@ function DebugBacktraceDecode({ [] ); + const [backtraceLocationsError, setBacktraceLocationsError] = + useState(""); + if (typeof backtraceAddresses === "string") { - return ; + return ( + + Something went wrong decoding the backtrace: {backtraceAddresses} + + ); } return ( @@ -74,23 +81,33 @@ function DebugBacktraceDecode({ if (!files) return; const file = files[0]; if (!file) return; - loadLocations(debug, backtraceAddresses, file).then((data) => - setBacktraceLocations(data) - ); + setBacktraceLocationsError(""); + loadLocations(debug, backtraceAddresses, file) + .then((data) => setBacktraceLocations(data)) + .catch((e) => setBacktraceLocationsError(`${e}`)); }} /> + {backtraceLocationsError && ( + + Something went wrong looking up the addresses in the file provided:{" "} + {backtraceLocationsError} + + )} ); } -function DebugError({ error }: { error: string }) { - return ( - <> -

Something went wrong decoding the backtrace

-

{error}

- - ); +const ErrorBlock = styled.div` + background-color: #f78f8f; + border: 2px solid #9c0a0a; + border-radius: 8px; + padding: 20px; + margin-top: 10px; +`; + +function DebugError({ children }: { children: ReactNode }) { + return {children}; } function makeNicePath(path: string) {