@useClassNameForSchema export class NotFoundError extends Model()({ _tag: prop(literal("NotFoundError")), message: prop(string) }) {} @useClassNameForSchema export class InvalidStateError extends Model()({ _tag: prop(literal("InvalidStateError")), message: prop(string) }) {} @useClassNameForSchema export class ValidationError extends Model()({ _tag: prop(literal("ValidationError")), errors: prop(array(unknown)) // meh }) {} @useClassNameForSchema export class NotLoggedInError extends Model()({ _tag: prop(literal("NotLoggedInError")) }) {} @useClassNameForSchema export class UnauthorizedError extends Model()({ _tag: prop(literal("UnauthorizedError")) }) {} @useClassNameForSchema export class OptimisticConcurrencyException extends Model()( { _tag: prop(literal("OptimisticConcurrencyException")) } ) {} const MutationOnlyErrors = { InvalidStateError, OptimisticConcurrencyException } const GeneralErrors = { NotFoundError, NotLoggedInError, UnauthorizedError, ValidationError } export const SupportedErrors = union({ ...MutationOnlyErrors, ...GeneralErrors }) ["|>"](named("SupportedErrors")) ["|>"](withDefaults) export type SupportedErrors = ParsedShapeOf // ideal? // export const QueryErrors = union({ ...GeneralErrors }) // ["|>"](named("QueryErrors")) // ["|>"](withDefaults) // export type QueryErrors = ParsedShapeOf // export const MutationErrors = union({ ...GeneralErrors, ...GeneralErrors }) // ["|>"](named("MutationErrors")) // ["|>"](withDefaults) // export type MutationErrors = ParsedShapeOf export const MutationErrors = SupportedErrors export const QueryErrors = SupportedErrors export type MutationErrors = ParsedShapeOf export type QueryErrors = ParsedShapeOf