cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Jan de Wit <>
Subject Re: Android Plugin API
Date Wed, 28 May 2014 19:05:47 GMT

> I don't know, it very much could be.  It could be that this makes sense in
> Obj-C but not in Java based on how they handle NoSuchMethod.  I'd prefer to
> not have to rely on an exception being caught, especially since it could
> suppress other exceptions being thrown that I want to know about.

Sending a message (calling a method) in object-c for a method that doesn’t exist will also
throw an exception, I haven’t looked at the implementation but I would suspect that there
is a test to see if the method (selector) is there.

> Also, I'm assuming the exception is NoSuchMethod, which isn't a safe
> assumption given that each device has their own quirks and this isn't
> guaranteed.

One could just lookup if the method exist and not just try to invoke it and wait for the NoSuchMethod.
That way one could make the error handling nicer, for example: 

You have a method called ‘myAction’ but it does not have the proper method signature!
Found public void myAction() but should be pubic PluginResult myAction(JSONArray, CallbackContext)

View raw message