checking in some work- adding custom errors and low-level compat with SecretService, but it may not be needed.

This commit is contained in:
2021-11-28 21:43:30 -05:00
parent cf24035c85
commit 3cab98e584
8 changed files with 416 additions and 92 deletions

28
sserror_funcs.go Normal file
View File

@@ -0,0 +1,28 @@
package gosecret
/*
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
}
func (e SecretServiceError) Error() (errStr string) {
errStr = e.ErrDesc
return
}