Skip to content

Commit

Permalink
catch invalid study topic json exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Oct 26, 2024
1 parent 18951c0 commit 31e47ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/Study.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import lila.study.Study.WithChapter
import lila.study.actorApi.{ BecomeStudyAdmin, Who }
import lila.study.{ Chapter, Orders, Settings, Study as StudyModel, StudyForm }
import lila.tree.Node.partitionTreeJsonWriter
import com.fasterxml.jackson.core.JsonParseException

final class Study(
env: Env,
Expand Down Expand Up @@ -534,7 +535,9 @@ final class Study(
def setTopics = AuthBody { ctx ?=> me ?=>
bindForm(StudyForm.topicsForm)(
_ => Redirect(routes.Study.topics),
topics => env.study.topicApi.userTopics(me, topics).inject(Redirect(routes.Study.topics))
topics =>
try env.study.topicApi.userTopics(me, topics).inject(Redirect(routes.Study.topics))
catch case e: JsonParseException => BadRequest(e.getMessage)
)
}

Expand Down

0 comments on commit 31e47ca

Please sign in to comment.