Skip to content

Commit

Permalink
chore: add debugging statement
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Dec 18, 2023
1 parent be7f9d8 commit 3392247
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions apps/web/app/connect/callback/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export default async function ConnectCallback({
data: {resourceId: res.data.connectionId as Id['reso']},
}
} catch (err) {
console.error('[oauth] Error during connect', err)
return {
type: 'ERROR',
data: {code: 'INTERNAL_SERVER_ERROR', message: `${err}`},
Expand Down
30 changes: 24 additions & 6 deletions packages/engine-backend/services/dbService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export function makeDBService({
) => {
const data = await get(tableName, id)
if (!data) {
throw new TRPCError({code: 'NOT_FOUND', message: `${tableName}: ${id}`})
throw new TRPCError({
code: 'NOT_FOUND',
message: `[db] ${tableName}: ${id} not found`,
})
}
return data
}
Expand Down Expand Up @@ -140,15 +143,21 @@ export function makeDBService({
const getConnectorConfigInfoOrFail = (id: Id['ccfg']) =>
metaService.listConnectorConfigInfos({id}).then((ints) => {
if (!ints[0]) {
throw new TRPCError({code: 'NOT_FOUND'})
throw new TRPCError({
code: 'NOT_FOUND',
message: `ccfg info not found: ${id}`,
})
}
return ints[0]
})

const getConnectorConfigOrFail = (id: Id['ccfg']) =>
metaService.tables.connector_config.get(id).then((_int) => {
if (!_int) {
throw new TRPCError({code: 'NOT_FOUND'})
throw new TRPCError({
code: 'NOT_FOUND',
message: `ccfg not found: ${id}`,
})
}
const int = zRaw.connector_config.parse(_int)
const connector = getConnectorOrFail(int.id)
Expand All @@ -159,7 +168,10 @@ export function makeDBService({
const getIntegrationOrFail = (id: Id['int']) =>
metaService.tables.integration.get(id).then(async (ins) => {
if (!ins) {
throw new TRPCError({code: 'NOT_FOUND'})
throw new TRPCError({
code: 'NOT_FOUND',
message: `int not found: ${id}`,
})
}
// TODO: Fix the root cause and ensure we always have integration.standard here
if (!ins.standard?.name) {
Expand All @@ -173,14 +185,20 @@ export function makeDBService({
const getResourceOrFail = (id: Id['reso']) =>
metaService.tables.resource.get(id).then((reso) => {
if (!reso) {
throw new TRPCError({code: 'NOT_FOUND'})
throw new TRPCError({
code: 'NOT_FOUND',
message: `reso not found: ${id}`,
})
}
return zRaw.resource.parse(reso)
})
const getPipelineOrFail = (id: Id['pipe']) =>
metaService.tables.pipeline.get(id).then((pipe) => {
if (!pipe) {
throw new TRPCError({code: 'NOT_FOUND'})
throw new TRPCError({
code: 'NOT_FOUND',
message: `pipe not found: ${id}`,
})
}
return zRaw.pipeline.parse(pipe)
})
Expand Down

1 comment on commit 3392247

@vercel
Copy link

@vercel vercel bot commented on 3392247 Dec 18, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

venice – ./

app.venice.is
venice-venice.vercel.app
venice-git-production-venice.vercel.app
usevenice.vercel.app

Please sign in to comment.