Skip to main content
Failing operations return *nono.Error. Use errors.Is with the exported sentinel errors when you need to branch on the failure kind.
err := caps.AllowPath("/missing", nono.AccessRead)
if errors.Is(err, nono.ErrPathNotFound) {
	log.Println("path does not exist")
}
Use errors.As when you need the numeric code or human-readable message from the native library.
var nonoErr *nono.Error
if errors.As(err, &nonoErr) {
	log.Println(nonoErr.Code(), nonoErr.Message())
}

Sentinel errors

SentinelMeaning
nono.ErrPathNotFoundThe path does not exist
nono.ErrExpectedDirectoryA directory was required
nono.ErrExpectedFileA file was required
nono.ErrPathCanonicalizationPath canonicalization failed
nono.ErrNoCapabilitiesNo capabilities were configured
nono.ErrSandboxInitPlatform sandbox initialization failed
nono.ErrUnsupportedPlatformSandboxing is unavailable on this platform
nono.ErrBlockedCommandA command was blocked by policy
nono.ErrConfigParseConfiguration parsing failed
nono.ErrProfileParseProfile parsing failed
nono.ErrIOAn I/O operation failed
nono.ErrInvalidArgAn invalid argument was passed
nono.ErrTrustVerificationTrust verification failed
nono.ErrUnknownUnknown or uncategorized failure
nono.Error.Is matches by error code, so the native message does not need to match the sentinel’s message.