Pattern matching extractor for the error code.
Pattern matching extractor for the error code.
import reactivemongo.api.commands.CommandError def testError(err: CommandError): String = err match { case CommandError.Code(code) => s"hasCode: $code" case _ => "no-code" }
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" }