aboutsummaryrefslogtreecommitdiff
path: root/user/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'user/user.go')
-rw-r--r--user/user.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/user/user.go b/user/user.go
index 704fed7..0d1cbe5 100644
--- a/user/user.go
+++ b/user/user.go
@@ -30,14 +30,12 @@ func (c Client) GetSelfUserInfo() (UserInfo, error) {
// get data from API
var userData UserInfo
- var errMessage Error
- data := c.requestHandler(endpoint)
- json.Unmarshal([]byte(data), &userData)
- json.Unmarshal([]byte(data), &errMessage)
-
- if errMessage.Err != "" {
- return userData, errors.New(errMessage.Err + " " + errMessage.Msg)
+ data, err := c.requestHandler(endpoint)
+ if err != nil {
+ return userData, err
}
+ json.Unmarshal([]byte(data), &userData)
+
return userData, nil
}