consent: Handle empty error as nil error in SQL helper
@@ -329,11 +329,14 @@ func newSQLHandledAuthenticationRequest(c *HandledAuthenticationRequest) (*sqlHa
}
func (s *sqlHandledAuthenticationRequest) toHandledAuthenticationRequest(a *AuthenticationRequest) (*HandledAuthenticationRequest, error) {
- var e RequestDeniedError
+ var e *RequestDeniedError
+ if len(s.Error) > 0 && s.Error != "{}" {
+ e = new(RequestDeniedError)
if err := json.Unmarshal([]byte(s.Error), &e); err != nil {
return nil, errors.WithStack(err)
}
+ }
return &HandledAuthenticationRequest{
RememberFor: s.RememberFor,
@@ -342,7 +345,7 @@ func (s *sqlHandledAuthenticationRequest) toHandledAuthenticationRequest(a *Auth
RequestedAt: s.RequestedAt,
WasUsed: s.WasUsed,
ACR: s.ACR,
- Error: &e,
+ Error: e,
AuthenticationRequest: a,
}, nil
}
