Future の中で明示的に例外をthrow しないようにしましょう。Future.failed を使う if 式は必ずelse 句書く。if は式なので必ず値を返す必要がある。命令型プログラミングとしてelse 句を 書かない場合もあるが、本来の使い方としては値を返すべき _ <- Future { if (!thread.hasMember(command.userAccountId)) throw new AddBookmarkForbiddenException("You are not a m } サマーインターンシップ2019 で学生とDDD なScala 開発に取り組んだ Scala 秋祭り 41 / 50
Future.failed(new AddBookmarkForbiddenException("You are not a member!")) else Future.succcessful(()) _ <- Future { if (!thread.hasMember(command.userAccountId)) throw new AddBookmarkForbiddenException("You are not a m } サマーインターンシップ2019 で学生とDDD なScala 開発に取り組んだ Scala 秋祭り 42 / 50