Skip to content

Commit

Permalink
update the message for unspported tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
libotony committed Sep 4, 2024
1 parent eb89507 commit a57bf94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion api/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ func (d *Debug) createTracer(name string, config json.RawMessage) (tracers.Trace
return tracers.DefaultDirectory.New(tracerName, config, false)
}

return tracers.DefaultDirectory.New(tracerName, config, d.allowCustomTracer)
if d.allowCustomTracer {
return tracers.DefaultDirectory.New(tracerName, config, true)
}

return nil, errors.New("tracer is not defined")
}

func (d *Debug) traceCall(ctx context.Context, tracer tracers.Tracer, header *block.Header, st *state.State, txCtx *xenv.TransactionContext, gas uint64, clause *tx.Clause) (interface{}, error) {
Expand Down
2 changes: 1 addition & 1 deletion api/debug/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ func TestCreateTracer(t *testing.T) {
assert.Nil(t, err)
assert.IsType(t, &logger.StructLogger{}, tr)
_, err = debug.createTracer("{result:()=>{}, fault:()=>{}}", nil)
assert.EqualError(t, err, "unsupported tracer")
assert.EqualError(t, err, "tracer is not defined")

tr, err = debug.createTracer("structLogger", nil)
assert.Nil(t, err)
Expand Down

0 comments on commit a57bf94

Please sign in to comment.