Skip to content

Commit

Permalink
Merge pull request #1667 from dedis/work-be2-lauener-prevent-rollcall…
Browse files Browse the repository at this point in the history
…-failure

Handle social channel creation error for invalid pop tokens
  • Loading branch information
K1li4nL authored Jun 11, 2023
2 parents 5669be0 + 2957967 commit eaaf4ad
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,15 @@ class RollCallHandler(dbRef: => AskableActorRef) extends MessageHandler {
private def createAttendeeChannels(rpcRequest: JsonRpcRequest): GraphMessage = {
val message: Message = rpcRequest.getParamsMessage.get
val data: CloseRollCall = message.decodedData.get.asInstanceOf[CloseRollCall]
val listAttendeeChannels: List[(Channel, ObjectType.ObjectType)] = data.attendees.map {
attendee => (generateSocialChannel(rpcRequest.getParamsChannel, attendee), ObjectType.CHIRP)
val listAttendeeChannels: List[(Channel, ObjectType.ObjectType)] = data.attendees.flatMap {
attendee =>
try {
Some((generateSocialChannel(rpcRequest.getParamsChannel, attendee), ObjectType.CHIRP))
} catch {
case _: Throwable =>
println(s"Failed to generate attendee social channel for pop token: \"${attendee.base64Data.data}\"")
None
}
}

val askCreateChannels = dbActor ? DbActor.CreateChannelsFromList(listAttendeeChannels)
Expand Down

0 comments on commit eaaf4ad

Please sign in to comment.