Skip to content

Instantly share code, notes, and snippets.

@thedevsaddam
Last active July 10, 2018 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thedevsaddam/994441918d5408075a695cfd803cbc4d to your computer and use it in GitHub Desktop.
Save thedevsaddam/994441918d5408075a695cfd803cbc4d to your computer and use it in GitHub Desktop.
How to handle error in gojsonq
package main
import (
"log"
"github.com/thedevsaddam/gojsonq"
)
func main() {
jq := gojsonq.New().File("./invalid-file.xjsn")
err := jq.Error()
if err != nil {
log.Fatal(err)
// 2018/06/25 00:48:58 gojsonq: open ./invalid-file.xjsn: no such file or directory
// exit status 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment