WriteResult

reactivemongo.api.commands.WriteResult$
See theWriteResult companion trait

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

object Code

Code extractor for WriteResult

Code extractor for WriteResult

import reactivemongo.api.commands.WriteResult

def codeOr(res: WriteResult, or: => Int): Int = res match {
 case WriteResult.Code(code) => code
 case _ => or
}

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Code.type
object Exception

Extracts exception details, if and only if it's an erroneous WriteResult.

Extracts exception details, if and only if it's an erroneous WriteResult.

import reactivemongo.api.commands.WriteResult

def printRes(res: WriteResult): Unit = res match {
 case WriteResult.Exception(cause) =>
   cause.printStackTrace()

 case _ =>
   println(s"OK: " + res)
}

Attributes

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

Code extractor for WriteResult

Code extractor for WriteResult

import reactivemongo.api.commands.WriteResult

def messageOr(res: WriteResult, or: => String): String = res match {
 case WriteResult.Message(msg) => msg
 case _ => or
}

Attributes

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