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/inflection v1.0.0
|
||||||
github.com/jinzhu/now v1.0.1
|
github.com/jinzhu/now v1.0.1
|
||||||
github.com/lib/pq v1.1.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
|
github.com/mattn/go-sqlite3 v2.0.1+incompatible
|
||||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd // indirect
|
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd // indirect
|
||||||
google.golang.org/appengine v1.4.0 // indirect
|
google.golang.org/appengine v1.4.0 // indirect
|
||||||
|
10
main.go
10
main.go
@ -5,6 +5,7 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
goerr "github.com/go-errors/errors"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -824,6 +825,15 @@ func (s *DB) AddError(err error) error {
|
|||||||
|
|
||||||
// GetErrors get happened errors from the db
|
// GetErrors get happened errors from the db
|
||||||
func (s *DB) GetErrors() []error {
|
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 {
|
if errs, ok := s.Error.(Errors); ok {
|
||||||
return errs
|
return errs
|
||||||
} else if s.Error != nil {
|
} else if s.Error != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user