2021-11-28 21:43:30 -05:00
|
|
|
package gosecret
|
|
|
|
|
2021-12-06 03:24:55 -05:00
|
|
|
// This currently is not used.
|
|
|
|
|
2021-11-28 21:43:30 -05:00
|
|
|
/*
|
|
|
|
TranslateError translates a SecretServiceErrEnum into a SecretServiceError.
|
|
|
|
If a matching error was found, ok will be true and err will be the matching SecretServiceError.
|
|
|
|
If no matching error was found, however, then ok will be false and err will be ErrUnknownSecretServiceErr.
|
|
|
|
*/
|
|
|
|
func TranslateError(ssErr SecretServiceErrEnum) (ok bool, err error) {
|
|
|
|
|
|
|
|
err = ErrUnknownSecretServiceErr
|
|
|
|
|
|
|
|
for _, e := range AllSecretServiceErrs {
|
|
|
|
if e.ErrCode == ssErr {
|
|
|
|
ok = true
|
|
|
|
err = e
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-12-06 03:24:55 -05:00
|
|
|
// Error returns the string format of the error; this is necessary to be considered a valid error interface.
|
2021-11-28 21:43:30 -05:00
|
|
|
func (e SecretServiceError) Error() (errStr string) {
|
|
|
|
|
|
|
|
errStr = e.ErrDesc
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|