mirror of
https://github.com/SigNoz/signoz.git
synced 2026-05-05 14:40:14 -05:00
fix: replace fmt.Errorf with signoz/pkg/errors and update golangci-li… (#9373)
This PR fulfills the requirements of #9069 by: - Adding a golangci-lint directive (forbidigo) to disallow all fmt.Errorf usages. - Replacing existing fmt.Errorf instances with structured errors from github.com/SigNoz/signoz/pkg/errors for consistent error classification and lint compliance. - Verified lint and build integrity.
This commit is contained in:
@@ -3,7 +3,6 @@ package sqlstoretest
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
"github.com/DATA-DOG/go-sqlmock"
|
||||
"github.com/SigNoz/signoz/pkg/errors"
|
||||
@@ -35,7 +34,7 @@ func New(config sqlstore.Config, matcher sqlmock.QueryMatcher) *Provider {
|
||||
} else if config.Provider == "postgres" {
|
||||
bunDB = bun.NewDB(db, pgdialect.New())
|
||||
} else {
|
||||
panic(fmt.Errorf("provider %q is not supported", config.Provider))
|
||||
panic(errors.NewInvalidInputf(errors.CodeInvalidInput, "provider %q is not supported", config.Provider))
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
@@ -71,9 +70,9 @@ func (provider *Provider) RunInTxCtx(ctx context.Context, opts *sql.TxOptions, c
|
||||
}
|
||||
|
||||
func (provider *Provider) WrapNotFoundErrf(err error, code errors.Code, format string, args ...any) error {
|
||||
return fmt.Errorf(format, args...)
|
||||
return errors.WrapNotFoundf(err, code, format, args...)
|
||||
}
|
||||
|
||||
func (provider *Provider) WrapAlreadyExistsErrf(err error, code errors.Code, format string, args ...any) error {
|
||||
return fmt.Errorf(format, args...)
|
||||
return errors.Wrapf(err, errors.TypeAlreadyExists, code, format, args...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user