Skip to content

Commit 3b5ddcd

Browse files
authored
Merge pull request graph-gophers#402 from mrnugget/sourcegraph/better-error-msg
More descriptive error when unmarshaling ID/Time
2 parents 5e581ee + 90e03d2 commit 3b5ddcd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

id.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package graphql
22

33
import (
4-
"errors"
4+
"fmt"
55
"strconv"
66
)
77

@@ -20,7 +20,7 @@ func (id *ID) UnmarshalGraphQL(input interface{}) error {
2020
case int32:
2121
*id = ID(strconv.Itoa(int(input)))
2222
default:
23-
err = errors.New("wrong type")
23+
err = fmt.Errorf("wrong type for ID: %T", input)
2424
}
2525
return err
2626
}

time.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (t *Time) UnmarshalGraphQL(input interface{}) error {
4141
t.Time = time.Unix(int64(input), 0)
4242
return nil
4343
default:
44-
return fmt.Errorf("wrong type")
44+
return fmt.Errorf("wrong type for Time: %T", input)
4545
}
4646
}
4747

0 commit comments

Comments
 (0)