|
@@ -70,7 +70,7 @@ type PathError struct {
|
|
|
Err error // Returned by the system call.
|
|
Err error // Returned by the system call.
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (e *PathError) String() string {
|
|
|
|
|
|
|
+func (e *PathError) Error() string {
|
|
|
return e.Op + " " + e.Path + ": "+ e.Err.Error()
|
|
return e.Op + " " + e.Path + ": "+ e.Err.Error()
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
@@ -107,7 +107,7 @@ type SyntaxError struct {
|
|
|
Offset int64
|
|
Offset int64
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (e *SyntaxError) String() string { return e.msg }
|
|
|
|
|
|
|
+func (e *SyntaxError) Error() string { return e.msg }
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
在调用代码中你可以像这样用类型断言测试错误是不是上面的类型:
|
|
在调用代码中你可以像这样用类型断言测试错误是不是上面的类型:
|