-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added error codes to enterprise * DH-5233 added naming enforcement for finetuning, db connection, and key * DH-5443 removed engine error code from enterprise * Error handling exceptions approach (#452) * DH-5437 add error handling exceptions --------- Co-authored-by: dishenwang2023 <[email protected]> * DH-5443 fixed created for organizations and added org_id for engine exceptions * DH-5443 moved exclude id to repo * DH-5443 removed org_id from error constructor * DH-5469 use new error response on all snackbars -- update error codes flows for payment and user * DH-5443 removed remaining org param from exception error constructors * DH-5347 add error response model to page api hooks -- fix build * DH-5443 replaced all http exception * DH-5503 add page error details --------- Co-authored-by: Juan Valacco <[email protected]>
- Loading branch information
1 parent
6edafcc
commit c2610d7
Showing
98 changed files
with
1,837 additions
and
800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
apps/ai/clients/admin-console/src/components/api-keys/error.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
apps/ai/clients/admin-console/src/components/databases/error.tsx
This file was deleted.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
apps/ai/clients/admin-console/src/components/error/error-details.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { cn, copyToClipboard } from '@/lib/utils' | ||
import { ErrorResponse } from '@/models/api' | ||
import { Copy } from 'lucide-react' | ||
import { FC, HTMLAttributes } from 'react' | ||
import { Button } from '../ui/button' | ||
import { toast } from '../ui/use-toast' | ||
|
||
type ErrorDetailsProps = HTMLAttributes<HTMLDivElement> & { | ||
error: ErrorResponse | ||
size?: 'default' | 'small' | ||
displayTitle?: boolean | ||
} | ||
|
||
const ErrorDetails: FC<ErrorDetailsProps> = ({ | ||
error, | ||
displayTitle = true, | ||
size = 'default', | ||
className, | ||
...props | ||
}) => { | ||
const handleCopyErrorTraceId = async () => { | ||
try { | ||
await copyToClipboard(error?.trace_id) | ||
toast({ | ||
variant: 'success', | ||
title: 'Error Trace ID copied!', | ||
}) | ||
} catch (error) { | ||
console.error('Could not copy text: ', error) | ||
toast({ | ||
variant: 'destructive', | ||
title: 'Could not copy the Error Trace ID', | ||
}) | ||
} | ||
} | ||
|
||
const isSmall = size === 'small' | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
'flex flex-col gap-2 max-w-fit', | ||
isSmall ? 'text-xs' : 'text-sm', | ||
className, | ||
)} | ||
{...props} | ||
> | ||
{displayTitle && <span className="font-semibold">Error details</span>} | ||
<div className="flex items-center gap-2"> | ||
<span className="font-semibold">Trace ID:</span> | ||
<span>{error.trace_id}</span> | ||
<Button | ||
type="button" | ||
variant="icon" | ||
className="p-0 h-fit text-slate-500" | ||
onClick={handleCopyErrorTraceId} | ||
> | ||
<Copy size={isSmall ? 12 : 14} strokeWidth={2} /> | ||
</Button> | ||
</div> | ||
<div className="flex items-center gap-2"> | ||
<span className="font-semibold">Description:</span> | ||
<span>{error.message}</span> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default ErrorDetails |
27 changes: 27 additions & 0 deletions
27
apps/ai/clients/admin-console/src/components/error/page-error-message.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Toaster } from '@/components/ui/toaster' | ||
import { ErrorResponse } from '@/models/api' | ||
import { AlertOctagon } from 'lucide-react' | ||
import { FC, HTMLAttributes } from 'react' | ||
import ErrorDetails from './error-details' | ||
|
||
export type PageErrorMessageProps = HTMLAttributes<HTMLDivElement> & { | ||
message: string | ||
error?: ErrorResponse | ||
} | ||
|
||
const PageErrorMessage: FC<PageErrorMessageProps> = ({ | ||
message, | ||
error, | ||
...props | ||
}) => ( | ||
<div className="flex flex-col gap-5 text-sm text-slate-500" {...props}> | ||
<div className="flex items-center gap-2"> | ||
<AlertOctagon size={18} strokeWidth={2.5} /> | ||
<span className="font-semibold">{message}</span> | ||
</div> | ||
{error && <ErrorDetails error={error} />} | ||
<Toaster /> | ||
</div> | ||
) | ||
|
||
export default PageErrorMessage |
11 changes: 0 additions & 11 deletions
11
apps/ai/clients/admin-console/src/components/fine-tunnings/error.tsx
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
apps/ai/clients/admin-console/src/components/golden-sql/error.tsx
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
apps/ai/clients/admin-console/src/components/hoc/WithApiFetcher.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import useApiFetcher from '@/hooks/api/generics/useApiFetcher' | ||
import { FC, ReactNode } from 'react' | ||
import { SWRConfig } from 'swr' | ||
|
||
const WithApiFetcher: FC<{ children: ReactNode }> = ({ children }) => { | ||
const { apiFetcher } = useApiFetcher() | ||
return ( | ||
<SWRConfig | ||
value={{ | ||
fetcher: apiFetcher, | ||
errorRetryCount: 0, | ||
}} | ||
> | ||
{children} | ||
</SWRConfig> | ||
) | ||
} | ||
|
||
export default WithApiFetcher |
15 changes: 0 additions & 15 deletions
15
apps/ai/clients/admin-console/src/components/layout/page-error-message.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.