MiGoller / ioBroker.xplora

Inofficial ioBroker adapter for Xplora® smartwatches.
MIT License
4 stars 0 forks source link

Don't let adapter terminate itself for 50x API-errors #7

Open MiGoller opened 2 years ago

MiGoller commented 2 years ago

Keep on the adapter retrying to connect to the Xplora API while ignoring 50x errors like "502 - bad gateway".

MiGoller commented 2 years ago

The GraphQL response looks like this.

{
    "response": {
        "error":"\r\n\r\n\r\n
502 Bad Gateway
\r\n
nginx/1.14.0 (Ubuntu)
\r\n\r\n\r\n",
        "status":502,
        "headers":{}},
        "request":{"query":" ... ",
        "variables":{ ... }
    }
}

Just check for status-code 502 to ignore the response and retry after some seconds.