update error message

This commit is contained in:
AJ ONeal 2020-08-14 03:38:29 -06:00
parent 752e901c65
commit b2aa111263
1 changed files with 11 additions and 2 deletions

View File

@ -315,11 +315,20 @@ func main() {
grants, err = telebit.Inspect(*authURL, *token)
if nil != err {
if dbg.Debug {
fmt.Fprintf(os.Stderr, "failed to inspect token: %s\n", err)
}
_, err := mgmt.Register(*authURL, ClientSecret, ppid)
if nil != err {
if !strings.Contains(err.Error(), `"E_NOT_FOUND"`) {
fmt.Fprintf(os.Stderr, "invalid client credentials: %s\n", err)
os.Exit(2)
} else {
fmt.Fprintf(os.Stderr, "failed to register client: %s\n", err)
os.Exit(1)
}
return
}
grants, err = telebit.Inspect(*authURL, *token)
if nil != err {
fmt.Fprintf(os.Stderr, "failed to authenticate after registering client: %s\n", err)