mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-19 14:45:44 +01:00
Give the directive grammar, flavours and reader failures one place each
This commit is contained in:
@@ -25,6 +25,9 @@ export type ParseError = ConvertError & { position: SourcePosition }
|
||||
|
||||
export type Result<T, E extends ConvertError = ConvertError> = { error: E; ok: false } | { ok: true; value: T }
|
||||
|
||||
// A reader with no path to name; the walk attaches the path where it knows it.
|
||||
export type Read<T> = { fault: ConvertFault; value?: undefined } | { fault?: undefined; value: T }
|
||||
|
||||
export function failure<T>(code: ConvertErrorCode, message: string, path: ConvertErrorPath): Result<T> {
|
||||
return { error: { code, message, path }, ok: false }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user