mirror of
https://github.com/terorie/od-database-crawler.git
synced 2025-04-10 05:56:42 +00:00
More descriptive error if /task/get returns invalid JSON
This commit is contained in:
parent
206ea0e91d
commit
8c5f99d616
@ -40,7 +40,9 @@ func FetchTask() (t *Task, err error) {
|
|||||||
|
|
||||||
t = new(Task)
|
t = new(Task)
|
||||||
err = json.NewDecoder(res.Body).Decode(t)
|
err = json.NewDecoder(res.Body).Decode(t)
|
||||||
if err != nil { return }
|
if _, ok := err.(*json.SyntaxError); ok {
|
||||||
|
return nil, fmt.Errorf("/task/get returned invalid JSON")
|
||||||
|
} else if err != nil { return }
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user