fix(executor): move startTime declaration before try block

The startTime variable was declared inside the try block but referenced
in the catch block, causing 'startTime is not defined' errors when
exceptions occurred before line 404 (e.g., during req.json() parsing).

Moving the declaration before the try ensures it's in scope for the
catch block's executionTimeMs calculation.
This commit is contained in:
Ajax Davis 2025-12-12 05:53:47 +10:00
parent 6b11a2f9a7
commit c2447e8467

View file

@ -378,6 +378,7 @@ async function loadAndDescribe(req: Request): Promise<Response> {
* Execute a tool with parameters
*/
async function executeTool(req: Request): Promise<Response> {
const startTime = Date.now();
try {
const body = await req.json();
const { packageName, exportName, version, importUrl, params, env } = body;
@ -401,7 +402,6 @@ async function executeTool(req: Request): Promise<Response> {
}
const cacheKey = `${packageName}::${exportName}`;
const startTime = Date.now();
// biome-ignore lint/suspicious/noImplicitAnyLet: Tool type is determined dynamically after import
let toolModule;