couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: Debugging show/view/list/filter etc code
Date Thu, 10 Dec 2009 20:04:50 GMT
On Wed, Dec 9, 2009 at 9:49 PM, Roger Binns <rogerb@rogerbinns.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Trying to debug this code (Javascript) is a royal pain.  It is like being
> back in the dark ages adding log() statements.  I have resorted to running
> my code separately directly under the 'js' interpreter but it isn't quite
> the same environment. (Sometimes you can even get tracebacks.  But you are
> out of luck if you have an exception while handling an exception!) The wiki
> is despairing for views and the situation is no better for
> shows/lists/filters etc.
>

I've been working on the query server JSON line protocol over the last
few days and have recently uncovered an as-yet-undiscovered trove of
much better error messages. I hope to have my coding done in the next
week or so, and the branch merged. For now you can follow along (and
help) here, although be warned that most JavaScript functionality
currently has it's guts hanging out like Johnny 5 after the bank
robbers beat him up. (apologies for the Short Circuit 2 reference...)

The branch: http://github.com/jchris/couchdb/tree/ddoc-qs

Chris

>  http://wiki.apache.org/couchdb/HTTP_view_API#Debugging_Views
>
> Anyway I think it is relatively easy to make nice interactive debugging
> possible as a feature of futon maybe with some server side help.  My guess
> is that you require Firebug in the client browser and then feed it a page of
> Javascript that emulates the server environment.  It would contain the
> defined show/view/list/filter and just enough glue to work (eg fetch the
> appropriate docs from the server, make emit and log send messages to Firebug
> console).  Then you just use the regular debugging functionality builtin to
> Firebug.
>
> It is also possible to extend this environment to help with compliance and
> testing.  For example it can emulate rereduce for views, shows with null
> docs etc.
>
> Roger
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAksgi9kACgkQmOOfHg372QT11QCbBZ8g7j/trfCoo52AFEiY0gY5
> Wd8AoKinzQV8LC9izLlNyE6sy8fgYmTd
> =R+Eg
> -----END PGP SIGNATURE-----
>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message