Under Review
over 1 year ago

Communications.makeWebRequest triggers "Not Enough Arguments Error" when simulating connection failure when using :context option

I tried simulating how Communications.makeWebRequest would perform when the device had no connection. The behavior seems inconsistent with documentation and also non-functional, since it calls the callback with a varying number of arguments.

Reproduction:

  1. Design a Communications.makeWebRequest flow that uses the optional :context option.
  2. Define a callback to accept it, like this:  public function onReply(responseCode as Lang.Number, data as Lang.Dictionary or Lang.String or Null, inContext as Lang.Object) 
  3. Toggle off connections: Settings>Connection Type>BLE>Not Connected and Settings>Connection Type>Wifi>Not Connected
  4. Cause a network call to happen

Outcome:

  • A runtime error occurs, indicating the line number of the callback function definition.  Error is: "Not Enough Arguments Error"

Expected outcome:

  • The number of arguments sent to the callback function should be the same, regardless of the connection state.  It's not possible to know before making the call how many arguments will come back, and monkey c doesn't have the option to mark arguments as optional.

CIQ 4.1.6

Epix (gen2)

Parents
  • it was shock for me when I have discovered that not all bugs are fixed.

    btw, I haven't tested, but maybe it will run when context is an object not primitive, so you can put as context dictionary with value of number maybe they have in code if(context) and context can be simple zero or null do

Comment
  • it was shock for me when I have discovered that not all bugs are fixed.

    btw, I haven't tested, but maybe it will run when context is an object not primitive, so you can put as context dictionary with value of number maybe they have in code if(context) and context can be simple zero or null do

Children
  • That’s what I do now (context is an object), and it’s causing the error. 

    So this isn’t just a simulator bug? Are you saying that context just isn’t usable on the actual device, since it could cause a runtime error if there’s a connection problem?

    It is working for me fine while I have a connection. I was just trying to see what happened without a connection on the simulator before trying on device.