Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for get error message of item through ItemError. #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions item.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type Item struct {
// LastValueType is the type of LastValue
// 0 - float; 1 - text; 3 - int;
LastValueType int

// ItemError is the error messege of the Item.
ItemError string
}


Expand Down
2 changes: 2 additions & 0 deletions item_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type jItem struct {
LastClock string `json:"lastclock,omitempty"`
LastValue string `json:"lastvalue,omitempty"`
LastValueType string `json:"value_type"`
ItemError string `json:"error,omitempty"`
}

// Item returns a native Go Item struct mapped from the given JSON Item data.
Expand Down Expand Up @@ -42,6 +43,7 @@ func (c *jItem) Item() (*Item, error) {
if err != nil {
return nil, fmt.Errorf("Error parsing Item LastValueType: %v", err)
}
item.ItemError = c.ItemError
return item, err
}

Expand Down