errors

package module
v0.0.0-...-fa5f906 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorToCode

func ErrorToCode(err error) (code string)

ErrorToCode 用 error 生成一个字符串 code

func SetHashFunc

func SetHashFunc(f HashFunc)

SetHashFunc 设置哈希函数

func Unwrap

func Unwrap[T any](err error) (res T, ok bool)

Unwrap 按类型将 wrapped 的错误类型提取出来。如果提取成功, 则返回对应的类型, 并且 ok == true

Types

type HashFunc

type HashFunc func(string) uint64

HashFunc 表示用于生成 error code 的哈希函数,返回的数值不得大于 0xFFFFF

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL