mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 04:42:25 -05:00
[bugfix/chore] oauth entropy fix + media cleanup tasks rewrite (#1853)
This commit is contained in:
parent
c4cf6326d8
commit
9a22102fa8
38 changed files with 2076 additions and 1090 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue