Skip to content

Commit

Permalink
#234 Updated panic error..
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzhang6222 committed May 20, 2020
1 parent 01d08fd commit 3211949
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions syntax/std_seq.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package syntax

import (
"fmt"
"reflect"
"strings"

"github.com/arr-ai/arrai/rel"
Expand Down Expand Up @@ -139,7 +138,7 @@ func stdSeq() rel.Attr {
}
}

panic(fmt.Errorf(sharedError, reflect.TypeOf(args[2])))
panic(fmt.Errorf("sub: unsupported args: %s, %s, %s", args[0], args[1], args[2]))
}),
createNestedFuncAttr("split", 2, func(args ...rel.Value) rel.Value {
switch args[1].(type) {
Expand All @@ -165,9 +164,7 @@ func stdSeq() rel.Attr {
}
}

panic(fmt.Errorf("expected subject sequence types are %s, %s and %s, but the actual type is %s",
reflect.TypeOf(rel.String{}), reflect.TypeOf(rel.Array{}), reflect.TypeOf(rel.Bytes{}),
reflect.TypeOf(args[2])))
panic(fmt.Errorf("split: unsupported args: %s, %s", args[0], args[1]))
}),
createNestedFuncAttr("join", 2, func(args ...rel.Value) rel.Value {
switch a1 := args[1].(type) {
Expand Down Expand Up @@ -197,7 +194,7 @@ func stdSeq() rel.Attr {
}
}

panic(fmt.Errorf(sharedError, reflect.TypeOf(args[2])))
panic(fmt.Errorf("join: unsupported args: %s, %s", args[0], args[1]))
}),
)
}
Expand Down Expand Up @@ -237,5 +234,3 @@ func strJoin(args ...rel.Value) rel.Value {
}
return rel.NewString([]rune(strings.Join(toJoin, mustAsString(args[0]))))
}

var sharedError = "expected subject sequence types are rel.String, rel.Array and rel.Bytes, but the actual type is %s"

0 comments on commit 3211949

Please sign in to comment.