SchemaError

zio.blocks.schema.SchemaError
See theSchemaError companion object
final case class SchemaError(errors: ::[Single]) extends Exception, NoStackTrace

A SchemaError reports why decoding, conversion or validation failed. It holds one or more SchemaError.Single failures, each with the path (DynamicOptic) of the place in the data where it happened. Schema#fromDynamicValue collects the failures of all record fields in one error, while the JSON codec stops at the first failure.

It extends Exception without a stack trace, so a Schema#transform function can throw it: the path of a failure says where it happened, not the stack.

val error = SchemaError.missingField(Nil, "title").atField("book") ++
 SchemaError.validationFailed("year must be positive").atField("year")

val text = error.message
// Missing field 'title' at: .book
// year must be positive at: .year

Attributes

See also
Companion
object
Source
SchemaError.scala
Graph
Supertypes
trait Product
trait Equals
trait NoStackTrace
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def ++(other: SchemaError): SchemaError

Returns an error with the failures of this error followed by those of other.

Returns an error with the failures of this error followed by those of other.

Attributes

Source
SchemaError.scala
def atCase(name: String): SchemaError

Prepends a case access to the path of all errors in this SchemaError.

Prepends a case access to the path of all errors in this SchemaError.

Attributes

Source
SchemaError.scala
def atField(name: String): SchemaError

Prepends a field access to the path of all errors in this SchemaError.

Prepends a field access to the path of all errors in this SchemaError.

Attributes

Source
SchemaError.scala
def atIndex(index: Int): SchemaError

Prepends an index access to the path of all errors in this SchemaError.

Prepends an index access to the path of all errors in this SchemaError.

Attributes

Source
SchemaError.scala

Prepends a map key access to the path of all errors in this SchemaError.

Prepends a map key access to the path of all errors in this SchemaError.

Attributes

Source
SchemaError.scala
override def getMessage: String

Attributes

Definition Classes
Source
SchemaError.scala
def message: String

The messages of all failures, one per line.

The messages of all failures, one per line.

Attributes

Source
SchemaError.scala

Inherited methods

final def addSuppressed(x$0: Throwable): Unit

Attributes

Inherited from:
Throwable
override def fillInStackTrace(): Throwable

Attributes

Definition Classes
NoStackTrace -> Throwable
Inherited from:
NoStackTrace
Source
NoStackTrace.scala

Attributes

Inherited from:
Throwable

Attributes

Inherited from:
Throwable

Attributes

Inherited from:
Throwable
final def getSuppressed(): Array[Throwable]

Attributes

Inherited from:
Throwable

Attributes

Inherited from:
Throwable

Attributes

Inherited from:
Throwable

Attributes

Inherited from:
Throwable
def printStackTrace(): Unit

Attributes

Inherited from:
Throwable
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala
def setStackTrace(x$0: Array[StackTraceElement]): Unit

Attributes

Inherited from:
Throwable
def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Inherited from:
Throwable