Skip to content

Commit

Permalink
fix(reporting) extend data for error reports to include version and a…
Browse files Browse the repository at this point in the history
… text asking for context

Signed-off-by: David Edler <[email protected]>
  • Loading branch information
edlerd committed Apr 29, 2024
1 parent 22ad583 commit abd176c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/ErrorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,30 @@ import {
} from "@canonical/react-components";
import { updateMaxHeight } from "util/updateMaxHeight";
import useEventListener from "@use-it/event-listener";
import { UI_VERSION } from "util/version";

type Props = {
error?: Error;
};

const ErrorPage: FC<Props> = ({ error }) => {
const body = encodeURIComponent(
`\`\`\`\n${error?.stack ?? "No stack trace"}\n\`\`\``,
`# Description
A brief description of the problem. Should include what you were
attempting to do, what you did, what happened and what you expected to
see happen.
# Metadata
UI Version: ${UI_VERSION}
Path: ${location.pathname}${location.search}
# Stacktrace
\`\`\`
${error?.stack ?? "No stack trace"}
\`\`\``,
);
const url = `https://github.com/canonical/lxd-ui/issues/new?labels=bug&title=Error%20report&body=${body}`;

Expand Down

0 comments on commit abd176c

Please sign in to comment.