mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-09 16:10:00 +08:00
feat(goctl): Add api parser (#2585)
This commit is contained in:
28
tools/goctl/pkg/parser/api/parser/error.go
Normal file
28
tools/goctl/pkg/parser/api/parser/error.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type errorManager struct {
|
||||
errors []string
|
||||
}
|
||||
|
||||
func newErrorManager() *errorManager {
|
||||
return &errorManager{}
|
||||
}
|
||||
|
||||
func (e *errorManager) add(err error) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
e.errors = append(e.errors, err.Error())
|
||||
}
|
||||
|
||||
func (e *errorManager) error() error {
|
||||
if len(e.errors)==0{
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf(strings.Join(e.errors, "\n"))
|
||||
}
|
||||
Reference in New Issue
Block a user