cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Mueller <>
Subject Re: Type checking in Cordova JS plugins
Date Thu, 22 Nov 2012 14:01:28 GMT
On Thu, Nov 22, 2012 at 6:00 AM, Brian LeRoux <> wrote:

> ya upon further consideration making these TypeException's feels right
> since, ideally, this error would only be seen by a plugin author and not
> something a plugin consumer (ideally)

huh?  I thought this was all about informing users when they pass invalid

I'm usually in favor of "fail fast" - and so throwing an exception when you
pass an invalid argument sounds right to me.  The problem is that even
though it's simple for us to fail fast by throwing an exception, we also
need to make sure it's super obvious to the user that a failure has
occurred.  That's the hard part.  Too many places where errors are silently
consumed by the runtime.

I think a console.log() would be appropriate - along with a thrown
exception - lots of folks have access to a "console" these days.  Or maybe
we should come up with a new API - reportFailure() or something, which we
could have - by default - just log to the console.  For platforms that
don't have an easily accessible console, they can override this to do
something visible for their platform.

Patrick Mueller

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