Verdict4sError

com.softinio.verdict4s.Verdict4sError
See theVerdict4sError companion class

The cases of Verdict4sError, and a constructor for API errors built from a raw response.

Attributes

Companion
class
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

final case class Api(status: Int, details: String, requestId: Option[String] = ..., retryAfter: Option[FiniteDuration] = ..., body: Option[ApiErrorBody] = ...) extends Verdict4sError

The service answered with a non-success status.

The service answered with a non-success status.

Value parameters

body

the error payload, parsed leniently

details

a short human-readable summary

requestId

the vendor's request id header (x-typesafe-request-id for Jev, x-request-id for OpenAI), for support

retryAfter

the Retry-After header, already parsed

status

the HTTP status code

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
final case class Decoding(details: String, field: Option[String] = ...) extends Verdict4sError

The service answered, but the body was not what we expect.

The service answered, but the body was not what we expect.

Value parameters

field

dotted path to the offending value, such as answers.tone.confidence, when it can be identified

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
final case class Invalid(errors: Type[Validation]) extends Verdict4sError

The aggregate of every Validation found in one request.

The aggregate of every Validation found in one request.

Raised in F once accumulation is over and sequencing begins.

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
final case class Refused(keys: NonEmptyList[QuestionKey], evaluation: Evaluation) extends Verdict4sError

The service declined to answer one or more questions.

The service declined to answer one or more questions.

Only OpenAI Decisions refuses, and it does so per question, without saying why. Every other question in the request may still have been answered: evaluation holds them all, with algebra.Answer.Refused under each key listed here. A question built with orRefused reads a refusal as None instead, and never contributes to this error.

Value parameters

evaluation

the complete response

keys

the questions that were refused

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
final case class Transport(details: String, underlying: Option[Throwable] = ...) extends Verdict4sError

The request never produced a usable response.

The request never produced a usable response.

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
final case class Validation(field: String, details: String) extends Verdict4sError

A single broken rule, found while building a request.

A single broken rule, found while building a request.

This is the leaf that ValidatedNec accumulates, so that a request with several malformed questions reports all of them rather than only the first.

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Inherited and Abstract types

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def fromResponse(status: Int, rawBody: Json, requestId: Option[String] = ..., retryAfter: Option[FiniteDuration] = ...): Api

Build an Api from a raw response.

Build an Api from a raw response.

Pure and HTTP-library-free, so the whole status-to-error mapping is unit tested in the core with no client involved.

Attributes