79201133

Date: 2024-11-18 19:11:03
Score: 0.5
Natty:
Report link

Apparently I was using a value when I should have used a pointer and my IDE did not detect the problem either:

func (p *Service) NewError(ctx context.Context, err error) (r *api.ErrorStatusCode) {
    var securityError *ogenerrors.SecurityError
    if ok := errors.As(err, &securityError); ok {
        // This works now 
        log.Println("this is a security error", err)
    }
}
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: helmi77