File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,9 @@ func (e *Exception) Error() string {
106
106
107
107
// Go error interface
108
108
func (e ExceptionInfo ) Error () string {
109
+ if e .Value == nil {
110
+ return "ExceptionInfo{<nil>}"
111
+ }
109
112
if exception , ok := e .Value .(* Exception ); ok {
110
113
return exception .Error ()
111
114
}
@@ -114,9 +117,17 @@ func (e ExceptionInfo) Error() string {
114
117
115
118
// Dump a traceback for exc to w
116
119
func (exc * ExceptionInfo ) TracebackDump (w io.Writer ) {
120
+ if exc == nil {
121
+ fmt .Fprintf (w , "Traceback <nil>\n " )
122
+ return
123
+ }
117
124
fmt .Fprintf (w , "Traceback (most recent call last):\n " )
118
125
exc .Traceback .TracebackDump (w )
119
- fmt .Fprintf (w , "%v: %v\n " , exc .Type .Name , exc .Value )
126
+ name := "<nil>"
127
+ if exc .Type != nil {
128
+ name = exc .Type .Name
129
+ }
130
+ fmt .Fprintf (w , "%v: %v\n " , name , exc .Value )
120
131
}
121
132
122
133
// Test for being set
You can’t perform that action at this time.
0 commit comments