Code

reactivemongo.api.commands.CommandException$.Code$
object 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

Members list

Concise view

Value members

Concrete methods

def unapply(scrutinee: Any): Option[Int]