Pattern matching extractor for the error message.
Pattern matching extractor for the error message.
import reactivemongo.api.commands.CommandError def testError(err: CommandError): String = err match { case CommandError.Message(msg) => s"hasMessage: $msg" case _ => "no-message" } def testWriteRes(res: WriteResult): String = res match { case CommandError.Message(msg) => s"onlyIfFailure: $msg" case _ => "no-message" }