Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

failWithCacheError

Step.failWithCacheError
fn failWithCacheError(
    s: *Step,
    maker: *Maker,
    man: *const Cache.Manifest,
    err: Cache.Manifest.HitError,
) error

File

Code

fn failWithCacheError(
    s: *Step,
    maker: *Maker,
    man: *const Cache.Manifest,
    err: Cache.Manifest.HitError,
) error{ OutOfMemory, Canceled, MakeFailed } {
    switch (err) {
        error.CacheCheckFailed => switch (man.diagnostic) {
            .none => unreachable,
            .manifest_create, .manifest_read, .manifest_lock => |e| return s.fail(maker, "failed checking cache: {t} {t}", .{
                man.diagnostic, e,
            }),
            .file_open, .file_stat, .file_read, .file_hash => |op| {
                const pp = man.files.keys()[op.file_index].prefixed_path;
                const prefix = man.cache.prefixes()[pp.prefix].path orelse "";
                return s.fail(maker, "failed checking cache: {s}{c}{s} {t} {t}", .{
                    prefix, Dir.path.sep, pp.sub_path, man.diagnostic, op.err,
                });
            },
        },
        error.OutOfMemory, error.Canceled => |e| return e,
        error.InvalidFormat => return s.fail(maker, "failed checking cache: invalid manifest file format", .{}),
    }
}