Path: blob/master/src/packages/frontend/components/error.tsx
1503 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;19const err = `${error}`.replace(/^Error:/, "").trim();20return (21<Alert22banner={banner}23style={style}24showIcon25message={message}26type="error"27description={28<div style={{ maxHeight: "150px", overflow: "auto", textWrap: "wrap" }}>29<StaticMarkdown value={err} />30</div>31}32onClose={() => setError?.("")}33closable={setError != null}34/>35);36}373839