Answer the architecture pass: one fault vocabulary, and the guards pinned where they compose
CI / gate (push) Successful in 5s

This commit is contained in:
2026-09-01 10:01:35 +02:00
parent f328ed4cab
commit f231f652ca
11 changed files with 59 additions and 38 deletions
+7 -2
View File
@@ -18,12 +18,13 @@ export type ConvertErrorCode =
export type ConvertErrorPath = readonly (number | string)[]
export type ConvertFault = {
export type ConvertError = {
code: ConvertErrorCode
message: string
path: ConvertErrorPath
}
export type ConvertError = ConvertFault & { path: ConvertErrorPath }
export type ConvertFault = Omit<ConvertError, 'path'>
export type Result<T> = { error: ConvertError; ok: false } | { ok: true; value: T }
@@ -31,6 +32,10 @@ export function failure<T>(code: ConvertErrorCode, message: string, path: Conver
return { error: { code, message, path }, ok: false }
}
export function faulted<T>(fault: ConvertFault, path: ConvertErrorPath): Result<T> {
return failure(fault.code, fault.message, path)
}
export function success<T>(value: T): Result<T> {
return { ok: true, value }
}