Skip to content

Commit a8e76a9

Browse files
d-csclaude
andcommitted
chore(webapp): downgrade QueryError logs in api.v1.query to warn
QueryError surfaces customer SQL problems and is returned as 400; not a system bug. Type-discriminate before the log call; warn for QueryError, error for unknown failures. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4dae56e commit a8e76a9

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

apps/webapp/app/routes/api.v1.query.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,25 @@ const { action, loader } = createActionApiRoute(
6161
});
6262

6363
if (!queryResult.success) {
64-
const message =
65-
queryResult.error instanceof QueryError
66-
? queryResult.error.message
67-
: "An unexpected error occurred while executing the query.";
64+
// QueryError surfaces customer SQL problems (invalid syntax,
65+
// unsupported construct). Returned to the caller as 400; system
66+
// handles it gracefully, no alert needed.
67+
if (queryResult.error instanceof QueryError) {
68+
logger.warn("Query API error", {
69+
error: queryResult.error.message,
70+
query,
71+
});
72+
return json({ error: queryResult.error.message }, { status: 400 });
73+
}
6874

6975
logger.error("Query API error", {
7076
error: queryResult.error,
7177
query,
7278
});
7379

7480
return json(
75-
{ error: message },
76-
{ status: queryResult.error instanceof QueryError ? 400 : 500 }
81+
{ error: "An unexpected error occurred while executing the query." },
82+
{ status: 500 }
7783
);
7884
}
7985

0 commit comments

Comments
 (0)