update
This commit is contained in:
parent
33ef36532d
commit
8437348fb5
1
go.mod
1
go.mod
@ -9,6 +9,7 @@ require (
|
||||
github.com/jinzhu/inflection v1.0.0
|
||||
github.com/jinzhu/now v1.0.1
|
||||
github.com/lib/pq v1.1.1
|
||||
github.com/go-errors/errors v1.0.2
|
||||
github.com/mattn/go-sqlite3 v2.0.1+incompatible
|
||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd // indirect
|
||||
google.golang.org/appengine v1.4.0 // indirect
|
||||
|
10
main.go
10
main.go
@ -5,6 +5,7 @@ import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
goerr "github.com/go-errors/errors"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -824,6 +825,15 @@ func (s *DB) AddError(err error) error {
|
||||
|
||||
// GetErrors get happened errors from the db
|
||||
func (s *DB) GetErrors() []error {
|
||||
errs := s.getErrors()
|
||||
wrapperErrors := []error{}
|
||||
for _, err := range errs {
|
||||
wrapperErrors = append(wrapperErrors, goerr.New(err))
|
||||
}
|
||||
return wrapperErrors
|
||||
}
|
||||
|
||||
func (s *DB) getErrors() []error {
|
||||
if errs, ok := s.Error.(Errors); ok {
|
||||
return errs
|
||||
} else if s.Error != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user