fix error wrapping (#1737)

This commit is contained in:
Caleb Doxsey 2021-01-05 12:46:14 -07:00 committed by GitHub
parent 3524697f6f
commit 6cc720a1b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 12 deletions

View file

@ -20,10 +20,7 @@ func Delete(ctx context.Context, client databroker.DataBrokerServiceClient, sess
Type: any.GetTypeUrl(), Type: any.GetTypeUrl(),
Id: sessionID, Id: sessionID,
}) })
if err != nil { return err
return fmt.Errorf("error deleting session: %w", err)
}
return nil
} }
// Get gets a session from the databroker. // Get gets a session from the databroker.
@ -35,7 +32,7 @@ func Get(ctx context.Context, client databroker.DataBrokerServiceClient, session
Id: sessionID, Id: sessionID,
}) })
if err != nil { if err != nil {
return nil, fmt.Errorf("error getting session from databroker: %w", err) return nil, err
} }
var s Session var s Session
@ -54,10 +51,7 @@ func Set(ctx context.Context, client databroker.DataBrokerServiceClient, s *Sess
Id: s.Id, Id: s.Id,
Data: any, Data: any,
}) })
if err != nil { return res, err
return nil, fmt.Errorf("error setting session in databroker: %w", err)
}
return res, nil
} }
// AddClaims adds the flattened claims to the session. // AddClaims adds the flattened claims to the session.

View file

@ -21,7 +21,7 @@ func Get(ctx context.Context, client databroker.DataBrokerServiceClient, userID
Id: userID, Id: userID,
}) })
if err != nil { if err != nil {
return nil, fmt.Errorf("error getting user from databroker: %w", err) return nil, err
} }
var u User var u User
@ -41,7 +41,7 @@ func Set(ctx context.Context, client databroker.DataBrokerServiceClient, u *User
Data: any, Data: any,
}) })
if err != nil { if err != nil {
return nil, fmt.Errorf("error setting user in databroker: %w", err) return nil, err
} }
return res.GetRecord(), nil return res.GetRecord(), nil
} }
@ -55,7 +55,7 @@ func SetServiceAccount(ctx context.Context, client databroker.DataBrokerServiceC
Data: any, Data: any,
}) })
if err != nil { if err != nil {
return nil, fmt.Errorf("error setting service account in databroker: %w", err) return nil, err
} }
return res.GetRecord(), nil return res.GetRecord(), nil
} }