File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -378,6 +378,9 @@ func SanitizeBinaryString(raw []byte) string {
378378}
379379
380380func FormatErrorStringCtx (ctx context.Context , e * Entry , cv * ComponentValue ) string {
381+ if e == nil || cv == nil {
382+ return ""
383+ }
381384 var ok bool
382385 var parsed []interface {}
383386 if res , err := NewSerializer ().
Original file line number Diff line number Diff line change @@ -170,6 +170,17 @@ func (r *RevertError) String() string {
170170 return b .String ()
171171}
172172
173+ // ErrorString returns the formatted error at this level only, e.g.
174+ // Error("not enough funds") or MyCustomError("0x1234","-100").
175+ // Unlike String(), it does not walk the Nested chain — use it when
176+ // you need the single-level description without recursive unwrapping.
177+ func (r * RevertError ) ErrorString () string {
178+ if r == nil {
179+ return ""
180+ }
181+ return FormatErrorStringCtx (context .Background (), r .ErrorEntry , r .cv )
182+ }
183+
173184// Signature returns the ABI signature of the error at this level,
174185// e.g. "Error(string)" or "AnError(string,uint256)".
175186func (r * RevertError ) Signature () (string , error ) {
You can’t perform that action at this time.
0 commit comments