Path: blob/master/src/packages/frontend/components/error.tsx
5713 views
import { Alert } from "antd";1import { CSSProperties } from "react";2import StaticMarkdown from "@cocalc/frontend/editors/slate/static-markdown";34interface Props {5error: any;6setError?: (error: any) => void;7style?: CSSProperties;8message?;9banner?;10}11export default function ShowError({12message = "Error",13error,14setError,15style,16banner,17}: Props) {18if (!error) return null;1920const err = `${error}`.replace(/^Error:/, "").trim();21return (22<Alert23banner={banner}24style={style}25showIcon26message={message}27type="error"28description={29<div style={{ maxHeight: "150px", overflow: "auto", textWrap: "wrap" }}>30<StaticMarkdown value={err} />31</div>32}33onClose={() => setError?.("")}34closable={setError != null}35/>36);37}383940