[bugfix/chore] oauth entropy fix + media cleanup tasks rewrite (#1853)

This commit is contained in:
kim
2023-06-22 20:46:36 +01:00
committed by GitHub
parent c4cf6326d8
commit 9a22102fa8
38 changed files with 2076 additions and 1090 deletions

View File

@@ -33,11 +33,35 @@ const (
statusCodeKey
notFoundKey
errorTypeKey
unrtrvableKey
wrongTypeKey
// Types returnable from Type(...).
TypeSMTP ErrorType = "smtp" // smtp (mail)
)
// Unretrievable ...
func Unretrievable(err error) bool {
_, ok := errors.Value(err, unrtrvableKey).(struct{})
return ok
}
// SetUnretrievable ...
func SetUnretrievable(err error) error {
return errors.WithValue(err, unrtrvableKey, struct{}{})
}
// WrongType ...
func WrongType(err error) bool {
_, ok := errors.Value(err, wrongTypeKey).(struct{})
return ok
}
// SetWrongType ...
func SetWrongType(err error) error {
return errors.WithValue(err, unrtrvableKey, struct{}{})
}
// StatusCode checks error for a stored status code value. For example
// an error from an outgoing HTTP request may be stored, or an API handler
// expected response status code may be stored.