Skip to content

Commit

Permalink
Rename mustHandleErr func
Browse files Browse the repository at this point in the history
  • Loading branch information
auvn committed May 21, 2023
1 parent 7a068fe commit 34988c5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ func newConnConfig(opts driverOptions) connConfig {
metric.WithUnit(unitMilliseconds),
metric.WithDescription(`The distribution of latencies of various calls in milliseconds`),
)
mustHandleErr(err)
mustNoError(err)

callsCounter, err := meter.Int64Counter(dbSQLClientCalls,
metric.WithUnit(unitDimensionless),
metric.WithDescription(`The number of various calls of methods`),
)
mustHandleErr(err)
mustNoError(err)

latencyRecorder := newMethodRecorder(latencyMsHistogram.Record, callsCounter.Add, opts.defaultAttributes...)

Expand Down
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func handleErr(err error) {
}
}

func mustHandleErr(err error) {
func mustNoError(err error) {
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions errors_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ func TestHandleError(t *testing.T) {
t.Parallel()

assert.Panics(t, func() {
mustHandleErr(errors.New("error"))
mustNoError(errors.New("error"))
})

assert.NotPanics(t, func() {
mustHandleErr(nil)
mustNoError(nil)
})

assert.NotPanics(t, func() {
Expand Down

0 comments on commit 34988c5

Please sign in to comment.