From 602f57ab509066b2bf59008077efa9003a88b9a1 Mon Sep 17 00:00:00 2001 From: blidd-google <112491344+blidd-google@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:18:30 -0500 Subject: [PATCH] Fix Task Queue Emulator error handling to display error message properly (#7916) * fix error message --- CHANGELOG.md | 1 + src/emulator/tasksEmulator.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 512ad9bb0c0..bbbb5c2ba30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,2 @@ +- Fix Task Queue Emulator error handling to display error message properly. (#7916) - Fixed some misleading logs when using the Data Connect emulator with `FIREBASE_DATACONNECT_POSTGRESQL_STRING` set. diff --git a/src/emulator/tasksEmulator.ts b/src/emulator/tasksEmulator.ts index 84ba5d61c31..f30af5b34e8 100644 --- a/src/emulator/tasksEmulator.ts +++ b/src/emulator/tasksEmulator.ts @@ -203,7 +203,11 @@ export class TasksEmulator implements EmulatorInstance { const locationId = req.params.location_id; const queueName = req.params.queue_name; if (!this.validateQueueId(queueName)) { - res.status(400).send("Invalid Queue ID"); + res.status(400).json({ + error: + "Queue ID must start with a letter followed by up to 62 letters, numbers, " + + "hyphens, or underscores and must end with a letter or a number", + }); return; } @@ -233,7 +237,7 @@ export class TasksEmulator implements EmulatorInstance { defaultUri: body.defaultUri, }; if (taskQueueConfig.rateLimits.maxConcurrentDispatches > 5000) { - res.status(400).send("cannot set maxConcurrentDispatches to a value over 5000"); + res.status(400).json({ error: "cannot set maxConcurrentDispatches to a value over 5000" }); return; }