Browse Source

Fix Exception.Error() output when e.val is nil and e is not

Valeriy Gorelov 1 year ago
parent
commit
2ac268b744
1 changed files with 4 additions and 2 deletions
  1. 4 2
      runtime.go

+ 4 - 2
runtime.go

@@ -386,11 +386,13 @@ func (e *Exception) String() string {
 }
 }
 
 
 func (e *Exception) Error() string {
 func (e *Exception) Error() string {
-	if e == nil || e.val == nil {
+	if e == nil {
 		return "<nil>"
 		return "<nil>"
 	}
 	}
 	var b bytes.Buffer
 	var b bytes.Buffer
-	b.WriteString(e.val.String())
+	if e.val != nil {
+		b.WriteString(e.val.String())
+	}
 	e.writeShortStack(&b)
 	e.writeShortStack(&b)
 	return b.String()
 	return b.String()
 }
 }