0

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());
        }
    }
stuckii95
  • 11
  • 3
  • 1
    Maybe you should search for 0x192 for the response (which is 402 in hexadecimal). As far as I know the response codes from the docs are listed in hexadecimal. According to this your error is a `no_bonding` error: https://docs.silabs.com/bluetooth/latest/error-codes – Daniel May 26 '19 at 10:21
  • I saw this one too. But my application is running in a simulator and never required a bonding before. Thats what confuses me and I was not sure if 0x192 is the actual response code. – stuckii95 May 26 '19 at 10:27

1 Answers1

0

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.

douglasr
  • 1,894
  • 1
  • 23
  • 29