Constructors of SchemaError values and the kinds of failure they hold.
The constructors that take a trace expect its path nodes from the innermost to the outermost, the order in which a decoder collects them. Pass Nil for the root, and add the path with atField and the other at* methods of the error.
Attributes
- Companion
- class
- Source
- SchemaError.scala
- Graph
-
- Supertypes
- Self type
-
SchemaError.type
Members list
Type members
Classlikes
A conversion or validation failed with the message details, optionally caused by the failures in cause.
A conversion or validation failed with the message details, optionally caused by the failures in cause.
Its message adds at: and the path when the path is not the root. When cause is set, the message lists the messages of cause under Caused by: instead, without the path.
Attributes
- Source
- SchemaError.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait IntoErrortrait Singleclass Objecttrait Matchableclass AnyShow all
The field fieldName appears more than once in the record at source.
The field fieldName appears more than once in the record at source.
Attributes
- Source
- SchemaError.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Singleclass Objecttrait Matchableclass AnyShow all
The value at source has the wrong shape; expectation says what was expected, as in Expected a record.
The value at source has the wrong shape; expectation says what was expected, as in Expected a record.
Attributes
- Source
- SchemaError.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Singleclass Objecttrait Matchableclass AnyShow all
The failures of conversions such as Into. ConversionFailed is the only one.
The failures of conversions such as Into. ConversionFailed is the only one.
Attributes
- Source
- SchemaError.scala
- Supertypes
- Known subtypes
-
class ConversionFailed
A failure described by the free text details.
A failure described by the free text details.
Unlike the other kinds, its message renders the path with DynamicOptic#toString, as in .format or .~ for a wrapped value, rather than with DynamicOptic#toScalaString, as in .format.when[Ebook] or .wrapped.
Attributes
- Source
- SchemaError.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Singleclass Objecttrait Matchableclass AnyShow all
A step of a schema migration failed at source; kind says how.
A step of a schema migration failed at source; kind says how.
Attributes
- Source
- SchemaError.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Singleclass Objecttrait Matchableclass AnyShow all
The kinds of MigrationError: PathNotFound (the path does not exist in the value), TypeMismatch (the value has the type actual where expected was required), MissingDefault (the field has no default value), TransformFailed and InvalidValue (with a reason), FieldNotFound, FieldAlreadyExists, CaseNotFound, and MandateFailed (making an optional field mandatory failed; not raised by the built-in migrations).
The kinds of MigrationError: PathNotFound (the path does not exist in the value), TypeMismatch (the value has the type actual where expected was required), MissingDefault (the field has no default value), TransformFailed and InvalidValue (with a reason), FieldNotFound, FieldAlreadyExists, CaseNotFound, and MandateFailed (making an optional field mandatory failed; not raised by the built-in migrations).
Attributes
- Companion
- trait
- Source
- SchemaError.scala
- Supertypes
- Self type
-
MigrationErrorKind.type
The ways a migration step can fail.
The ways a migration step can fail.
Attributes
- Companion
- object
- Source
- SchemaError.scala
- Supertypes
- Known subtypes
-
class CaseNotFoundclass FieldAlreadyExistsclass FieldNotFoundclass InvalidValueclass MandateFailedclass MissingDefaultobject PathNotFoundclass TransformFailedclass TypeMismatchShow all
The record at source has no field fieldName. The message is Missing field '' at:.
The record at source has no field fieldName. The message is Missing field '' at:.
Attributes
- Source
- SchemaError.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Singleclass Objecttrait Matchableclass AnyShow all
One failure: a message and the path of the place where it happened.
One failure: a message and the path of the place where it happened.
Attributes
- Source
- SchemaError.scala
- Supertypes
- Known subtypes
-
class DuplicatedFieldclass ExpectationMismatchtrait IntoErrorclass ConversionFailedclass Messageclass MigrationErrorclass MissingFieldclass UnknownCaseShow all
The variant at source has no case named caseName.
The variant at source has no case named caseName.
Attributes
- Source
- SchemaError.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Singleclass Objecttrait Matchableclass AnyShow all
Inherited and Abstract types
The names of the product elements.
The name of the type.
Value members
Concrete methods
Creates a Message error with the free-text message details at the root path.
Creates a Message error with the free-text message details at the root path.
Attributes
- Source
- SchemaError.scala
Creates a MigrationError of kind CaseNotFound at path.
Creates a ConversionFailed error with the message details at the path trace.
Creates a ConversionFailed error with the message details at the path trace.
Attributes
- Source
- SchemaError.scala
Creates a ConversionFailed error at the root that wraps cause. Its message is contextMessage followed by the messages of cause under Caused by:, and does not show the error's own path, even after atField.
Creates a ConversionFailed error at the root that wraps cause. Its message is contextMessage followed by the messages of cause under Caused by:, and does not show the error's own path, even after atField.
Attributes
- Source
- SchemaError.scala
Creates a DuplicatedField error for the field fieldName that appears more than once in the record at the path trace.
Creates a DuplicatedField error for the field fieldName that appears more than once in the record at the path trace.
Attributes
- Source
- SchemaError.scala
Creates an ExpectationMismatch error, for a value of the wrong shape, with the message expectation at the path trace.
Creates an ExpectationMismatch error, for a value of the wrong shape, with the message expectation at the path trace.
Attributes
- Source
- SchemaError.scala
Creates a MigrationError of kind FieldAlreadyExists at path.
Creates a MigrationError of kind FieldNotFound at path.
Creates a MigrationError of kind InvalidValue at path.
Creates a MigrationError of kind MandateFailed at path.
Creates a Message error with the free-text message details at path, the root by default.
Creates a Message error with the free-text message details at path, the root by default.
Attributes
- Source
- SchemaError.scala
Creates a MigrationError of kind kind at path.
Creates a MigrationError of kind MissingDefault at path.
Creates a MissingField error for the absent field fieldName of the record at the path trace.
Creates a MissingField error for the absent field fieldName of the record at the path trace.
Attributes
- Source
- SchemaError.scala
Creates a MigrationError of kind PathNotFound at path.
Creates a MigrationError of kind TransformFailed at path.
Creates a MigrationError of kind TypeMismatch at path.
Creates an UnknownCase error for the case caseName that the variant at the path trace does not have.
Creates an UnknownCase error for the case caseName that the variant at the path trace does not have.
Attributes
- Source
- SchemaError.scala
Creates an error with the message message at the root path, for a value that breaks a rule. It is the same as conversionFailed(Nil, message).
Creates an error with the message message at the root path, for a value that breaks a rule. It is the same as conversionFailed(Nil, message).
Throw it from the to function of Schema#transform, or from a smart constructor that to calls, to reject a value while decoding. The decoder keeps only the message, at a path that ends in .wrapped, the step into the transformed value: Schema#fromDynamicValue returns it as a new ConversionFailed, and the JSON codec as a new ExpectationMismatch.
final case class Title(value: String)
object Title {
def make(value: String): Title =
if (value.trim.nonEmpty) Title(value)
else throw SchemaError.validationFailed("title must not be blank")
implicit val schema: Schema[Title] = Schema[String].transform(make, _.value)
}
val title = "\"Zionomicon\"".fromJson[Title] // Right(Title(Zionomicon))
val blank = "\" \"".fromJson[Title]
// Left(zio.blocks.schema.SchemaError: title must not be blank at: .wrapped)
Attributes
- See also
- Source
- SchemaError.scala