How to debug when develop on view

I want to do some testing on view. but I might get some error like:
Syntax error in the map function of the view `VIEW_NAME*’: SyntaxError: Unexpected token !
when I edit view by http://{couchbase_server}:8091.
Is there some logs or debug tools or development method for view developing?

Can you paste here your map function?

In fact, I means that this is a common question.I want to know how to develop on view quickly.