Skip to content

Commit

Permalink
use e5
Browse files Browse the repository at this point in the history
  • Loading branch information
reusee committed Sep 2, 2022
1 parent af804e2 commit 8126153
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"fmt"

"github.com/reusee/e4"
"github.com/reusee/e5"
)

type (
Expand All @@ -15,7 +15,7 @@ var (
pt = fmt.Printf
as = errors.As
is = errors.Is
he = e4.Handle
we = e4.Wrap
throw = e4.Throw
he = e5.Handle
we = e5.Wrap
throw = e5.Throw
)
8 changes: 4 additions & 4 deletions call_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dscope
import (
"reflect"

"github.com/reusee/e4"
"github.com/reusee/e5"
)

type CallResult struct {
Expand All @@ -19,14 +19,14 @@ func (c CallResult) Extract(targets ...any) {
targetValue := reflect.ValueOf(target)
if targetValue.Kind() != reflect.Ptr {
panic(we.With(
e4.Info("%T is not a pointer", target),
e5.Info("%T is not a pointer", target),
)(
ErrBadArgument,
))
}
if targetValue.Type().Elem() != c.Values[i].Type() {
panic(we.With(
e4.Info("%T is not a pointer to %v",
e5.Info("%T is not a pointer to %v",
target,
targetValue.Type().Elem()),
)(
Expand All @@ -45,7 +45,7 @@ func (c CallResult) Assign(targets ...any) {
targetValue := reflect.ValueOf(target)
if targetValue.Kind() != reflect.Ptr {
panic(we.With(
e4.Info("%v is not a pointer", target),
e5.Info("%v is not a pointer", target),
)(
ErrBadArgument,
))
Expand Down
6 changes: 3 additions & 3 deletions dscope.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"runtime"
"sync"

"github.com/reusee/e4"
"github.com/reusee/e5"
"github.com/reusee/pr"
)

Expand Down Expand Up @@ -102,7 +102,7 @@ func (scope Scope) Assign(objs ...any) {
v := reflect.ValueOf(o)
if v.Kind() != reflect.Ptr {
throw(we.With(
e4.Info("%T is not a pointer", o),
e5.Info("%T is not a pointer", o),
)(
ErrBadArgument,
))
Expand Down Expand Up @@ -136,7 +136,7 @@ func (scope Scope) get(id _TypeID, t reflect.Type) (
value, ok := scope.values.LoadOne(id)
if !ok {
return ret, we.With(
e4.Info("no definition for %v", t),
e5.Info("no definition for %v", t),
)(
ErrDependencyNotFound,
)
Expand Down
18 changes: 9 additions & 9 deletions fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sort"
"strings"

"github.com/reusee/e4"
"github.com/reusee/e5"
)

type _Forker struct {
Expand Down Expand Up @@ -51,7 +51,7 @@ func newForker(
numOut := defType.NumOut()
if numOut == 0 {
throw(we.With(
e4.Info("%T returns nothing", def),
e5.Info("%T returns nothing", def),
)(
ErrBadArgument,
))
Expand Down Expand Up @@ -99,7 +99,7 @@ func newForker(

default:
throw(we.With(
e4.Info("%T is not a valid definition", def),
e5.Info("%T is not a valid definition", def),
)(
ErrBadArgument,
))
Expand Down Expand Up @@ -133,16 +133,16 @@ func newForker(
color := colors[id]
if color == 1 {
return we.With(
e4.Info("found dependency loop in definition %v", values[0].DefType),
func() e4.WrapFunc {
e5.Info("found dependency loop in definition %v", values[0].DefType),
func() e5.WrapFunc {
buf := new(strings.Builder)
for i, id := range path {
if i > 0 {
buf.WriteString(" -> ")
}
buf.WriteString(typeIDToType(id).String())
}
return e4.Info("path: %s", buf.String())
return e5.Info("path: %s", buf.String())
}(),
)(
ErrDependencyLoop,
Expand All @@ -167,8 +167,8 @@ func newForker(
value2, ok := valuesTemplate.Load(id2)
if !ok {
return we.With(
e4.Info("dependency not found in definition %v", value.DefType),
e4.Info("no definition for %v", requiredType),
e5.Info("dependency not found in definition %v", value.DefType),
e5.Info("no definition for %v", requiredType),
)(
ErrDependencyNotFound,
)
Expand Down Expand Up @@ -213,7 +213,7 @@ func newForker(
t := typeIDToType(values[0].TypeID)
if getReducerType(t) == nil {
return we.With(
e4.Info("%v has multiple definitions", t),
e5.Info("%v has multiple definitions", t),
)(
ErrBadDefinition,
)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/reusee/dscope
go 1.18

require (
github.com/reusee/e4 v0.0.0-20220624024633-9eab321f05d6
github.com/reusee/pr v0.0.0-20220624024755-23e64bd7728c
github.com/reusee/e5 v0.0.0-20220902143513-42365073754d
github.com/reusee/pr v0.0.0-20220902144504-5f8b9d810f6f
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/reusee/e4 v0.0.0-20220624024633-9eab321f05d6 h1:HG863jGFtcMuLte70apB3jC7lvgiTSWUnoHuDa9S0+A=
github.com/reusee/e4 v0.0.0-20220624024633-9eab321f05d6/go.mod h1:kZmlM15C4htN/zwSQz5HJPQo8BCZY5NnmkyZBDqjwc4=
github.com/reusee/pr v0.0.0-20220624024755-23e64bd7728c h1:1yv1SCRQTrs0l6Sr2gHry5uOCAE3zEXmgmjXieH8RF4=
github.com/reusee/pr v0.0.0-20220624024755-23e64bd7728c/go.mod h1:P5LL5BRHQGKJjYiV77MzYpmB+7V8BUAbEzaUmKELuMk=
github.com/reusee/e5 v0.0.0-20220902143513-42365073754d h1:Hbb0lWLMOmVl8p3KwsXLH8rKqJtHKhIEB7BTbZbvxm0=
github.com/reusee/e5 v0.0.0-20220902143513-42365073754d/go.mod h1:kfVSDXYZocDqR1uRQfewKHmcLa/QtjGl/Ik0/vqhZ4s=
github.com/reusee/pr v0.0.0-20220902144504-5f8b9d810f6f h1:mDDBdR+d2CvQjjm9EKEtVJqva9BSr4Aot6WpLv2h9jc=
github.com/reusee/pr v0.0.0-20220902144504-5f8b9d810f6f/go.mod h1:ByEquMmqXZQzG7VHsfuwgutPe/utoaaDJS9VJJ46uik=
6 changes: 3 additions & 3 deletions initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"
"sync/atomic"

"github.com/reusee/e4"
"github.com/reusee/e5"
)

type _Initializer struct {
Expand Down Expand Up @@ -33,8 +33,8 @@ func (i *_Initializer) get(scope Scope) (ret []reflect.Value, err error) {
continue
}
return nil, we.With(
e4.Info("found dependency loop when calling %T", i.Def),
e4.Info("path: %+v", scope.path),
e5.Info("found dependency loop when calling %T", i.Def),
e5.Info("path: %+v", scope.path),
)(
ErrDependencyLoop,
)
Expand Down

0 comments on commit 8126153

Please sign in to comment.