Skip to content

Commit

Permalink
Fix Task Queue Emulator error handling to display error message prope…
Browse files Browse the repository at this point in the history
…rly (#7916)

* fix error message
  • Loading branch information
blidd-google authored Nov 12, 2024
1 parent 07c7cd8 commit 602f57a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 6 additions & 2 deletions src/emulator/tasksEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 602f57a

Please sign in to comment.