File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 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 {
106106
107107// Go error interface
108108func (e ExceptionInfo ) Error () string {
109+ if e .Value == nil {
110+ return "ExceptionInfo{<nil>}"
111+ }
109112 if exception , ok := e .Value .(* Exception ); ok {
110113 return exception .Error ()
111114 }
@@ -114,9 +117,17 @@ func (e ExceptionInfo) Error() string {
114117
115118// Dump a traceback for exc to w
116119func (exc * ExceptionInfo ) TracebackDump (w io.Writer ) {
120+ if exc == nil {
121+ fmt .Fprintf (w , "Traceback <nil>\n " )
122+ return
123+ }
117124 fmt .Fprintf (w , "Traceback (most recent call last):\n " )
118125 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 )
120131}
121132
122133// Test for being set
You can’t perform that action at this time.
0 commit comments