type nftablesError … // wrapError wraps an error resulting from running nft func wrapError(err error) error { … } // notFoundError returns an nftablesError with the given message for which IsNotFound will // return true. func notFoundError(format string, args ...interface{ … } // existsError returns an nftablesError with the given message for which IsAlreadyExists // will return true. func existsError(format string, args ...interface{ … } func (nerr *nftablesError) Error() string { … } func (nerr *nftablesError) Unwrap() error { … } // IsNotFound tests if err corresponds to an nftables "not found" error of any sort. // (e.g., in response to a "delete rule" command, this might indicate that the rule // doesn't exist, or the chain doesn't exist, or the table doesn't exist.) func IsNotFound(err error) bool { … } // IsAlreadyExists tests if err corresponds to an nftables "already exists" error (e.g. // when doing a "create" rather than an "add"). func IsAlreadyExists(err error) bool { … }