cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazron <shaz...@gmail.com>
Subject Re: Android Plugin API
Date Wed, 28 May 2014 20:07:36 GMT
https://github.com/apache/cordova-ios/blob/50ca482c8e861c1aa480dadba726b1abbacbc0e1/CordovaLib/Classes/CDVCommandQueue.m#L193-L198


On Wed, May 28, 2014 at 12:05 PM, Erik Jan de Wit <edewit@redhat.com> wrote:

>
> >
> > 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)
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message