Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ld
go-ld-prime
Commits
40bacb4f
Commit
40bacb4f
authored
Aug 12, 2019
by
Eric Myhre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix docs references missed by exact string match.
Signed-off-by:
Eric Myhre
<
hash@exultant.us
>
parent
2e3868c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
errors.go
errors.go
+3
-3
fluent/fluentNode.go
fluent/fluentNode.go
+1
-1
fluent/fluentRecover_test.go
fluent/fluentRecover_test.go
+2
-2
impl/typed/errors.go
impl/typed/errors.go
+1
-1
No files found.
errors.go
View file @
40bacb4f
...
...
@@ -9,7 +9,7 @@ import (
// that node concretely contains.
//
// For example, calling AsString on a map will return ErrWrongKind.
// Calling Lookup
String
on an int will similarly return ErrWrongKind.
// Calling Lookup on an int will similarly return ErrWrongKind.
type
ErrWrongKind
struct
{
// CONSIDER: if we should add a `TypeName string` here as well?
// It seems to be useful information, and in many places we've shoved it
...
...
@@ -36,8 +36,8 @@ func (e ErrWrongKind) Error() string {
return
fmt
.
Sprintf
(
"func called on wrong kind: %s called on a %s node, but only makes sense on %s"
,
e
.
MethodName
,
e
.
ActualKind
,
e
.
AppropriateKind
)
}
// ErrNotExists may be returned from the
traversal
functions of the Node
//
interface
to indicate a missing value.
// ErrNotExists may be returned from the
lookup
functions of the Node
interface
// to indicate a missing value.
//
// Note that typed.ErrNoSuchField is another type of error which sometimes
// occurs in similar places as ErrNotExists. ErrNoSuchField is preferred
...
...
fluent/fluentNode.go
View file @
40bacb4f
...
...
@@ -9,7 +9,7 @@ import (
// which makes chaining calls easier.
//
// The very first error value encountered will be stored, and can be viewed later.
// After an error is encountered, all subsequent
traversal
methods will
// After an error is encountered, all subsequent
lookup
methods will
// silently return the same error-storing node.
// Any of the terminal scalar-returning methods will panic if an error is stored.
// (The fluent.Recover function can be used to nicely gather these panics.)
...
...
fluent/fluentRecover_test.go
View file @
40bacb4f
...
...
@@ -10,7 +10,7 @@ import (
)
func
TestRecover
(
t
*
testing
.
T
)
{
t
.
Run
(
"simple
traversal
error should capture"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"simple
lookup
error should capture"
,
func
(
t
*
testing
.
T
)
{
Wish
(
t
,
Recover
(
func
()
{
WrapNode
(
&
ipldfree
.
Node
{})
.
LookupIndex
(
0
)
.
AsString
()
...
...
@@ -20,7 +20,7 @@ func TestRecover(t *testing.T) {
Error
{
ipld
.
ErrWrongKind
{
MethodName
:
"LookupIndex"
,
AppropriateKind
:
ipld
.
ReprKindSet_JustList
,
ActualKind
:
ipld
.
ReprKind_Invalid
}},
)
})
t
.
Run
(
"correct
traversal
should return nil"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"correct
lookup
should return nil"
,
func
(
t
*
testing
.
T
)
{
Wish
(
t
,
Recover
(
func
()
{
n
,
_
:=
ipldfree
.
NodeBuilder
()
.
CreateString
(
"foo"
)
...
...
impl/typed/errors.go
View file @
40bacb4f
...
...
@@ -6,7 +6,7 @@ import (
"github.com/ipld/go-ipld-prime/schema"
)
// ErrNoSuchField may be returned from
traversal
functions on the Node
// ErrNoSuchField may be returned from
lookup
functions on the Node
// interface when a field is requested which doesn't exist, or from Insert
// on a MapBuilder when a key doesn't match a field name in the structure.
type
ErrNoSuchField
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment