Skip to content

Conversation

@abdotop
Copy link
Contributor

@abdotop abdotop commented Nov 10, 2025

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.

- Add logs & deployement in seed
- LeftPanel only visible from DB tabs
- Trace / Span style
- Dense log view
@abdotop abdotop self-assigned this Nov 10, 2025
@abdotop abdotop changed the title DT-80: Refactor standardize error handling, consolidate frontend logic, and update seed data DT-84: Refactor standardize error handling, consolidate frontend logic, and update seed data Nov 10, 2025
@abdotop abdotop marked this pull request as ready for review November 10, 2025 09:55
return data
if (!res.ok) throw Error(await res.text())
return await res.json()
}
Copy link
Member

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)

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()}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be needed

// API signal for current project
export const project = api['GET/api/project'].signal()

export const onRun = (query: string) => {
Copy link
Member

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) => {

const handleKeyDown = (e: KeyboardEvent) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
e.preventDefault()
const q = url.params.q
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants