Files
lo/docs/data/core-errorsas.md
T
2025-10-06 17:15:49 +02:00

758 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
ErrorsAs errorsas errors.go#L351 core error-handling https://go.dev/play/p/8wk5rH8UfrE
core#error-handling#erroras
core#error-handling#validate
core#error-handling#mustx
core#error-handling#tryx
core#error-handling#tryorx
core#error-handling#trycatch
core#error-handling#trywitherrorvalue
core#error-handling#trycatchwitherrorvalue
core#error-handling#assert
70
func ErrorsAs[T error](err error) (T, bool)

A generic wrapper around errors.As that returns the typed error and a boolean indicating success.

if rateLimitErr, ok := lo.ErrorsAs[*RateLimitError](err); ok {
    // handle
}