3 ms·
i use this a lot if error.Is(err, sql.ErrNoRow) { return status.Error(codes.NotFound, "foo does not exist") } srv.log.Err(err).Msg("failed to load foo") retu
by hknmtt 4y ago
i use this a lot
if error.Is(err, sql.ErrNoRow) {
return status.Error(codes.NotFound, "foo does not exist")
}
srv.log.Err(err).Msg("failed to load foo")
return status.Error(codes.InternalError, "")
True, that checking for more than one error type is very sparse but i still like the go errors the way they are.