alecthomas / alecthomas/participle
Improve error message for custom capture
- 主要語言
- Go
- 星號
- 3.9k
- 分支
- 213
- PR 合併指標
- 30 天內沒有已合併 PR
描述
If custom capture generate an error, then user will receive an error message with full struct name.
```
diff --git a/_examples/ini/main.go b/_examples/ini/main.go
index be6ec9e..e483923 100644
--- a/_examples/ini/main.go
+++ b/_examples/ini/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "errors"
"os"
"github.com/alecthomas/repr"
@@ -51,11 +52,17 @@ type String struct {
func (String) value() {}
type Number struct {
- Number float64 `@Float`
+ Number N `@Float`
}
func (Number) value() {}
+type N struct{}
+
+func (*N) Capture(values []string) error {
+ return errors.New("problem")
+}
+
```
`
panic: Number.Number: problem
`
An error message with type name or token name will be much better:
`: problem`
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。