Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetValue ¶ added in v0.6.14
GetValue returns the first key-matched value found in the error details, or nil.
Example ¶
package main
import (
"fmt"
"io"
"gitlab.com/picnic-app/backend/libs/golang/core/errs"
)
func main() {
err := io.EOF
err = errs.WithValue(err, "key", "value")
fmt.Println(errs.GetValue(err, "key"))
}
Output: value
func GetValues ¶ added in v0.6.14
GetValues returns all details stored in the error.
Example ¶
package main
import (
"fmt"
"io"
"gitlab.com/picnic-app/backend/libs/golang/core/errs"
)
func main() {
err := io.EOF
err = errs.WithValue(err, "key1", "value")
err = errs.WithValue(err, "key2", 1)
err = errs.WithValue(err, "key2", 2)
err = errs.WithValue(err, "key2", 3)
fmt.Println(errs.GetValues(err))
}
Output: map[key1:value key2:[1 2 3]]
func WithValue ¶ added in v0.6.14
WithValue returns error storing the value for the specified key.
Example ¶
package main
import (
"io"
"gitlab.com/picnic-app/backend/libs/golang/core/errs"
)
func main() {
err := io.EOF
_ = errs.WithValue(err, "some_key", "some_value")
}
Example (Nil) ¶
package main
import (
"gitlab.com/picnic-app/backend/libs/golang/core/errs"
)
func main() {
_ = errs.WithValue(nil, "some_key", "some_value")
}
Types ¶
Click to show internal directories.
Click to hide internal directories.