CommandException

reactivemongo.api.commands.CommandException$

Error extractor for command results

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

object Code

Pattern matching extractor for the error code.

Pattern matching extractor for the error code.

import reactivemongo.core.errors.DatabaseException
import reactivemongo.api.commands.{ CommandException, WriteResult }

def testError(err: DatabaseException): String = err match {
 case CommandException.Code(code) => s"hasCode: \$code"
 case _ => "no-code"
}

def testWriteRes(res: WriteResult): String = res match {
 case CommandException.Code(code) => s"onlyIfFailure: \$code"
 case _ => "no-code"
}

Attributes

See also:
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Code.type
object Message

Pattern matching extractor for the error message.

Pattern matching extractor for the error message.

import reactivemongo.core.errors.DatabaseException
import reactivemongo.api.commands.{ CommandException, WriteResult }

def testError(err: DatabaseException): String = err match {
 case CommandException.Message(msg) => s"hasMessage: \$msg"
 case _ => "no-message"
}

def testWriteRes(res: WriteResult): String = res match {
 case CommandException.Message(msg) => s"onlyIfFailure: \$msg"
 case _ => "no-message"
}

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Message.type