What does the BLE-status code "-402" mean?

1.6k Views Asked by At

I have a GarminIQ-project. Therefore I make a request. Since yesterday I get the error code -402.

According to https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Communications/OAuthMessage.html#responseCode-instance_method negative values stand for BLE-responses, positive are the http-requestCode. Does anybody know what -402 stands for?

I am using the Connect IQ SDK 3.0.10.

I tried to find out, what the error code is meaning. But I haven't found a list with code "-402" or "402"

Down below are the two code snippets that are used for the request. The argument url is our api-url. This works fine in a browser.

//This function makes the request
function makeRequest(url) {
        jsonFile = Communications.makeJsonRequest(url, {}, {}, method(:onReceive));
    }

//This is the callback method that is called, when data have arrived
function onReceive(responseCode, data){

        if (responseCode == 200) {
            notify.invoke(1, data);
        }else {         
            System.println(responseCode);
            notify.invoke(0, "Failed to load\nError: "+responseCode.toString());
        }
    }
1

There are 1 best solutions below

0
douglasr On

If you look at the API docs for the Communications module, you will see that -402 is the error code returned when the results sent back from your request were too large.

NETWORK_RESPONSE_TOO_LARGE = -402

Most devices have a very limited amount of memory and so you may need to run your request through some sort of proxy server to make the request and then trim down the results to only what you require back before sending the data to your device.