mirror of
https://github.com/Pungyeon/clean-go-article.git
synced 2024-11-14 02:34:03 +00:00
changed made based on issue 28
This commit is contained in:
parent
1aead7e4d1
commit
a8493ef2e8
|
@ -296,7 +296,8 @@ Once we're done with our first attempt at refactoring the function, we can proce
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetItem(extension string) (Item, error) {
|
func GetItem(extension string) (Item, error) {
|
||||||
if ref, ok := getReference(extension) {
|
ref, ok := getReference(extension)
|
||||||
|
if !ok {
|
||||||
return EmptyItem, ErrReferenceNotFound
|
return EmptyItem, ErrReferenceNotFound
|
||||||
}
|
}
|
||||||
return getItemByReference(ref)
|
return getItemByReference(ref)
|
||||||
|
@ -748,7 +749,7 @@ type ErrorDetails interface {
|
||||||
|
|
||||||
type errDetails struct {
|
type errDetails struct {
|
||||||
errtype error
|
errtype error
|
||||||
details string
|
details interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewErrorDetails(err error, details ...interface{}) ErrorDetails {
|
func NewErrorDetails(err error, details ...interface{}) ErrorDetails {
|
||||||
|
|
Loading…
Reference in a new issue