Skip to content

Commit

Permalink
fix(tRPC): throw an error when creating a GridBot with no grid lines
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed Aug 29, 2024
1 parent 5a7994c commit c5c0ca3
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export async function createGridBot({ ctx, input }: Options) {
});
}

if (data.settings.gridLines.length === 0) {
throw new TRPCError({
message: "The bot has no configured grid lines. Please set at least one grid line",
code: "PARSE_ERROR",
});
}

const bot = await xprisma.bot.grid.create({
data: {
...data,
Expand Down

0 comments on commit c5c0ca3

Please sign in to comment.