Remove catch-all error handler in preview endpoint to help debug tests.
This commit is contained in:
parent
6d41b890db
commit
afa757f21a
|
@ -281,48 +281,44 @@ export async function preview(
|
||||||
return { previewSchema, nestedSchemaFields }
|
return { previewSchema, nestedSchemaFields }
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
const inputs: QueryEvent = {
|
||||||
const inputs: QueryEvent = {
|
appId: ctx.appId,
|
||||||
appId: ctx.appId,
|
queryVerb: query.queryVerb,
|
||||||
queryVerb: query.queryVerb,
|
fields: query.fields,
|
||||||
fields: query.fields,
|
parameters: enrichParameters(query),
|
||||||
parameters: enrichParameters(query),
|
transformer: query.transformer,
|
||||||
transformer: query.transformer,
|
schema: query.schema,
|
||||||
schema: query.schema,
|
nullDefaultSupport: query.nullDefaultSupport,
|
||||||
nullDefaultSupport: query.nullDefaultSupport,
|
queryId,
|
||||||
queryId,
|
datasource,
|
||||||
datasource,
|
// have to pass down to the thread runner - can't put into context now
|
||||||
// have to pass down to the thread runner - can't put into context now
|
environmentVariables: envVars,
|
||||||
environmentVariables: envVars,
|
ctx: {
|
||||||
ctx: {
|
user: ctx.user,
|
||||||
user: ctx.user,
|
auth: { ...authConfigCtx },
|
||||||
auth: { ...authConfigCtx },
|
},
|
||||||
},
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const { rows, keys, info, extra } = await Runner.run<QueryResponse>(inputs)
|
const { rows, keys, info, extra } = await Runner.run<QueryResponse>(inputs)
|
||||||
const { previewSchema, nestedSchemaFields } = getSchemaFields(rows, keys)
|
const { previewSchema, nestedSchemaFields } = getSchemaFields(rows, keys)
|
||||||
|
|
||||||
// if existing schema, update to include any previous schema keys
|
// if existing schema, update to include any previous schema keys
|
||||||
if (existingSchema) {
|
if (existingSchema) {
|
||||||
for (let key of Object.keys(previewSchema)) {
|
for (let key of Object.keys(previewSchema)) {
|
||||||
if (existingSchema[key]) {
|
if (existingSchema[key]) {
|
||||||
previewSchema[key] = existingSchema[key]
|
previewSchema[key] = existingSchema[key]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remove configuration before sending event
|
}
|
||||||
delete datasource.config
|
// remove configuration before sending event
|
||||||
await events.query.previewed(datasource, ctx.request.body)
|
delete datasource.config
|
||||||
ctx.body = {
|
await events.query.previewed(datasource, ctx.request.body)
|
||||||
rows,
|
ctx.body = {
|
||||||
nestedSchemaFields,
|
rows,
|
||||||
schema: previewSchema,
|
nestedSchemaFields,
|
||||||
info,
|
schema: previewSchema,
|
||||||
extra,
|
info,
|
||||||
}
|
extra,
|
||||||
} catch (err: any) {
|
|
||||||
ctx.throw(400, err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue