FormattedError

This commit is contained in:
Gregory Schier
2026-03-12 19:48:43 -07:00
parent 77ec87ea17
commit 3c4035097a
7 changed files with 6 additions and 11 deletions

View File

@@ -1,8 +1,7 @@
import { Banner, Button, InlineCode } from '@yaakapp-internal/ui';
import type { ErrorInfo, ReactNode } from 'react';
import { Component, useEffect } from 'react';
import { showDialog } from '../lib/dialog';
import { Banner, InlineCode } from '@yaakapp-internal/ui';
import { Button } from './core/Button';
import RouteError from './RouteError';
interface ErrorBoundaryProps {

View File

@@ -2,7 +2,7 @@ import { linter } from '@codemirror/lint';
import type { EditorView } from '@codemirror/view';
import { jsoncLanguage } from '@shopify/lang-jsonc';
import type { GrpcRequest } from '@yaakapp-internal/models';
import { InlineCode, VStack } from '@yaakapp-internal/ui';
import { FormattedError, InlineCode, VStack } from '@yaakapp-internal/ui';
import classNames from 'classnames';
import {
handleRefresh,
@@ -19,7 +19,6 @@ import { pluralizeCount } from '../lib/pluralize';
import { Button } from './core/Button';
import type { EditorProps } from './core/Editor/Editor';
import { Editor } from './core/Editor/LazyEditor';
import { FormattedError } from './core/FormattedError';
import { GrpcProtoSelectionDialog } from './GrpcProtoSelectionDialog';
type Props = Pick<EditorProps, 'heightMode' | 'onChange' | 'className' | 'forceUpdateKey'> & {

View File

@@ -1,7 +1,5 @@
import { Heading, VStack } from '@yaakapp-internal/ui';
import { Button } from './core/Button';
import { Button, FormattedError, Heading, VStack } from '@yaakapp-internal/ui';
import { DetailsBanner } from './core/DetailsBanner';
import { FormattedError } from './core/FormattedError';
export default function RouteError({ error }: { error: unknown }) {
console.log('Error', error);

View File

@@ -1,23 +0,0 @@
import classNames from 'classnames';
import type { ReactNode } from 'react';
interface Props {
children: ReactNode;
className?: string;
}
export function FormattedError({ children, className }: Props) {
return (
<pre
className={classNames(
className,
'cursor-text select-auto',
'[&_*]:cursor-text [&_*]:select-auto',
'font-mono text-sm w-full bg-surface-highlight p-3 rounded',
'whitespace-pre-wrap border border-danger border-dashed overflow-x-auto',
)}
>
{children}
</pre>
);
}

View File

@@ -11,8 +11,7 @@ import type { DropdownItem } from '../core/Dropdown';
import { Dropdown } from '../core/Dropdown';
import type { EditorProps } from '../core/Editor/Editor';
import { Editor } from '../core/Editor/LazyEditor';
import { FormattedError } from '../core/FormattedError';
import { Banner, Icon } from '@yaakapp-internal/ui';
import { Banner, FormattedError, Icon } from '@yaakapp-internal/ui';
import { Separator } from '../core/Separator';
import { tryFormatGraphql } from '../../lib/formatters';
import { showGraphQLDocExplorerAtom } from './graphqlAtoms';

View File

@@ -1,7 +1,6 @@
import type { BatchUpsertResult } from '@yaakapp-internal/models';
import { VStack } from '@yaakapp-internal/ui';
import { FormattedError, VStack } from '@yaakapp-internal/ui';
import { Button } from '../components/core/Button';
import { FormattedError } from '../components/core/FormattedError';
import { ImportDataDialog } from '../components/ImportDataDialog';
import { activeWorkspaceAtom } from '../hooks/useActiveWorkspace';
import { createFastMutation } from '../hooks/useFastMutation';