-
Notifications
You must be signed in to change notification settings - Fork 0
DT-84: Refactor standardize error handling, consolidate frontend logic, and update seed data #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Add logs & deployement in seed - LeftPanel only visible from DB tabs - Trace / Span style - Dense log view
…age in LogsViewer
| return data | ||
| if (!res.ok) throw Error(await res.text()) | ||
| return await res.json() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class SQLQueryError extends Error {
constructor(message: string, body: string) {
super(message)
this.type = 'unexpected'
this.sqlMessage = 'unexpected error'
try {
const errorDetails = JSON.parse(body)
const errorTypes = ['service-error', 'bad-query', 'timeout']
if (errorTypes.has(errorDetails.type)) this.type = errorDetails.type
if (typeof errorDetails.sqlMessage === 'string') this.sqlMessage = errorDetails.sqlMessage
} catch {
this.sqlMessage = body
}
},
type: 'service-error' | 'bad-query' | 'unexpected' | 'timeout'
sqlMessage: string
}
const body = res.text()
if (res.ok) return JSON.parse(body)
throw new SQLQueryError(`sql endpoint error ${res.status}`, body)
web/pages/DeploymentPage.tsx
Outdated
| params={{ expanded: isExpanded ? null : table.table }} | ||
| class='shrink-0' | ||
| class='shrink-0 p-1 hover:bg-base-300 rounded transition-colors flex items-center justify-center' | ||
| onClick={(e) => e.stopPropagation()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not be needed
web/lib/shared.tsx
Outdated
| // API signal for current project | ||
| export const project = api['GET/api/project'].signal() | ||
|
|
||
| export const onRun = (query: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const runQuery = (query?: string) => {
web/pages/DeploymentPage.tsx
Outdated
| const handleKeyDown = (e: KeyboardEvent) => { | ||
| if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') { | ||
| e.preventDefault() | ||
| const q = url.params.q |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// no need to check `runQuery` already does it
runQuery(url.params.q)…pdating its usage in QueryHistory and DeploymentPage components
This pull request introduces several improvements and refactors across the backend and frontend, focusing on error handling, code organization, and test data seeding. The most notable changes include standardizing error handling in API routes, consolidating shared frontend logic, updating seed data for deployments and logs, and improving type consistency in schemas. These updates enhance maintainability, robustness, and developer experience.