github.com/alloyzeus/go-azfl@v0.0.0-20231220071816-9740126a2d07/azcore/errors.go (about) 1 package azcore 2 3 import errors "github.com/alloyzeus/go-azfl/errors" 4 5 // Error is the module error type. 6 type Error error 7 8 const ( 9 ErrUserContextRequired = constantErrorDescriptor("user context required") 10 ErrServiceContextRequired = constantErrorDescriptor("service context required") 11 ) 12 13 func UserContextRequiredError(details error) error { 14 return errors.Access().Desc(ErrUserContextRequired).Wrap(details) 15 } 16 17 func ServiceContextRequiredError(details error) error { 18 return errors.Access().Desc(ErrServiceContextRequired).Wrap(details) 19 } 20 21 type constantErrorDescriptor string 22 23 var ( 24 _ error = constantErrorDescriptor("") 25 ) 26 27 func (e constantErrorDescriptor) Error() string { return string(e) } 28 func (e constantErrorDescriptor) ErrorDescriptorString() string { return string(e) }