File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -360,6 +360,22 @@ func (e *Exception) M__getattr__(name string) (Object, error) {
360360 return e .Args , nil // FIXME All attributes are args!
361361}
362362
363+ func (e * Exception ) M__str__ () (Object , error ) {
364+ msg := e .Args .(Tuple )[0 ]
365+ return msg , nil
366+ }
367+
368+ func (e * Exception ) M__repr__ () (Object , error ) {
369+ msg := e .Args .(Tuple )[0 ].(String )
370+ typ := e .Base .Name
371+ return String (fmt .Sprintf ("%s(%q)" , typ , string (msg ))), nil
372+ }
373+
363374// Check Interfaces
364- var _ error = (* Exception )(nil )
365- var _ error = (* ExceptionInfo )(nil )
375+ var (
376+ _ error = (* ExceptionInfo )(nil )
377+
378+ _ error = (* Exception )(nil )
379+ _ I__str__ = (* Exception )(nil )
380+ _ I__repr__ = (* Exception )(nil )
381+ )
You can’t perform that action at this time.
0 commit comments