Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
keynmol committed Sep 27, 2024
1 parent addd0b8 commit 8017813
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/server.cask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ object OptimizerServer extends cask.MainRoutes:
error(s"Population size above maximum [${Limits.MaxPopulation}]")
else if attrs.generations > Limits.MaxGenerations then
error(s"Number of generations above maximum [${Limits.MaxGenerations}]")
else if attrs.generations <= 0 || attrs.populationSize <=0 then
error(s"Generations and population size must both be non-negative")
else
val (id, job) = createJob(attrs)
cask.Response(id.toString(), 200)
Expand Down
2 changes: 2 additions & 0 deletions backend/server.http4s.scala
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ def routes(
error(
s"Number of generations above maximum [${Limits.MaxGenerations}]"
)
else if attrs.generations <= 0 || attrs.populationSize <=0 then
error(s"Generations and population size must both be non-negative")
else manager.createJob(attrs).flatMap((id, _) => Ok(id.toString()))
end if

Expand Down

0 comments on commit 8017813

Please sign in to comment.