> What still scars me in terms of incorporating Clojure as a language of
choice in more
> complicated projects I work on in my other life, is the error reporting
facility. The
> errors sometimes might as well just say 'I just cannot run!'. It would
be nice if
> there was some facility to approximately point to some s-exp or line
numbers.
I agree that some of the stacktraces make it difficult to track down where
an error is. I've lately dealt with that by writing a lot of :pre and :post
assertions. That tends to narrow everything down very quickly. For
instance:
(defn get-count [request]
{:pre [
(= (type request) clojure.lang.PersistentHashMap)
(= (type (get-in request [:params :item-type])) java.lang.String)
]
:post [
(= (type %) java.lang.Long)
(or (pos? %) (zero? %))
]}
(monger/get-count (get-in request [:params :item-type])))
At the top level of my app, I wrap everything in a try/catch and print out
(clojure.stacktrace//print-stack-trace e). It's a bit of work, but once I
wrote enough :pre and :post conditions they became sufficient to give me
exact information about where any error occurred.
On Friday, December 27, 2013 8:48:55 PM UTC-5, Guru Devanla wrote:
>
> Seconded on Error reporting.
>
> I have been playing around with Clojure for sometime now and also
> completed almost 150 of the 4clojure problems. What still scars me in terms
> of incorporating Clojure as a language of choice in more complicated
> projects I work on in my other life, is the error reporting facility. The
> errors sometimes might as well just say 'I just cannot run!'. It would be
> nice if there was some facility to approximately point to some s-exp or
> line numbers.
>
> May be I am missing some workflow used by other expert users. Can someone
> throw more light on this.
>
>
> Thanks
> Guru
>
>
> On Fri, Dec 27, 2013 at 3:44 PM, Daniel <[email protected] <javascript:>
> > wrote:
>
>> Best: Language & Community
>> Worst: Error Reporting
>>
>>
>> On Friday, December 27, 2013 3:17:48 PM UTC-6, Kelker Ryan wrote:
>>>
>>> In your opinion, what's the best, and what's the worst aspects of using
>>> Clojure?
>>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected]<javascript:>
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.