Re: Handling exceptions (subject renamed)

2012-10-05 Thread Matan Safriel
Awesome.


On Fri, Oct 5, 2012 at 8:40 PM, gaz jones  wrote:

> http://clojure.github.com/clojure/clojure.stacktrace-api.html
>
> On Fri, Oct 5, 2012 at 12:06 PM, Matt  wrote:
> > Hi,
> >
> > Sorry to anyone who read the original post.
> > Apparently I had malformed the try block encompassing the create-table
> in a
> > very non-clojure-ish way.
> > So my problem wasn't with clojure.java.jdbc's create-table. Being
> 'dynamic',
> > clojure could not warn me about it until it crashes in runtime. I guess I
> > should also learn more about making exception printouts contain more
> details
> > (such as line number as one, if that's at all possible?)
> > I'd appreciate knowing how to get more details when an exception is
> caught
> > by my code e.g. at least a line number if possible -
> >
> > I was using -
> > (catch Exception e (println (str "Exception is: " e)))
> >
> > Which only yielded a general description (java.lang.ClassCastException:
> > clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn)
> > without indicating where my code broke.
> >
> > Is it possible to get the source line that made the code break?
> >
> > Thanks!
> >
> > On Friday, October 5, 2012 5:15:18 PM UTC+2, Matt wrote:
> >>
> >> Hi,
> >>
> >> I'm relatively new to Clojure. This must be easy.
> >> I am trying to write a function that creates a table with a name passed
> as
> >> argument, and this naturally requires passing
> clojure.java.jdbc/create-table
> >> a value for the table name, rather than specifying the name as a
> constant.
> >> However I'm not insofar able to pull it off.
> >>
> >> When I use the form create-table passed-argument [fields] as opposed to
> a
> >> constant as in create-table :hard-coded-entity-name [fields], then the
> table
> >> gets successfully created in the database, however my code also gets an
> >> exception - java.lang.ClassCastException:
> clojure.lang.ArraySeq$ArraySeq_int
> >> cannot be cast to clojure.lang.IFn. The exception is received even
> though
> >> the table had been seemingly perfectly created. I'm probably missing
> >> something basic. What do you think can it be?
> >>
> >> Thanks,
> >> Matt
> >>
> >>
> >>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> your
> > first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > 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 post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Handling exceptions (subject renamed)

2012-10-05 Thread gaz jones
http://clojure.github.com/clojure/clojure.stacktrace-api.html

On Fri, Oct 5, 2012 at 12:06 PM, Matt  wrote:
> Hi,
>
> Sorry to anyone who read the original post.
> Apparently I had malformed the try block encompassing the create-table in a
> very non-clojure-ish way.
> So my problem wasn't with clojure.java.jdbc's create-table. Being 'dynamic',
> clojure could not warn me about it until it crashes in runtime. I guess I
> should also learn more about making exception printouts contain more details
> (such as line number as one, if that's at all possible?)
> I'd appreciate knowing how to get more details when an exception is caught
> by my code e.g. at least a line number if possible -
>
> I was using -
> (catch Exception e (println (str "Exception is: " e)))
>
> Which only yielded a general description (java.lang.ClassCastException:
> clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn)
> without indicating where my code broke.
>
> Is it possible to get the source line that made the code break?
>
> Thanks!
>
> On Friday, October 5, 2012 5:15:18 PM UTC+2, Matt wrote:
>>
>> Hi,
>>
>> I'm relatively new to Clojure. This must be easy.
>> I am trying to write a function that creates a table with a name passed as
>> argument, and this naturally requires passing clojure.java.jdbc/create-table
>> a value for the table name, rather than specifying the name as a constant.
>> However I'm not insofar able to pull it off.
>>
>> When I use the form create-table passed-argument [fields] as opposed to a
>> constant as in create-table :hard-coded-entity-name [fields], then the table
>> gets successfully created in the database, however my code also gets an
>> exception - java.lang.ClassCastException: clojure.lang.ArraySeq$ArraySeq_int
>> cannot be cast to clojure.lang.IFn. The exception is received even though
>> the table had been seemingly perfectly created. I'm probably missing
>> something basic. What do you think can it be?
>>
>> Thanks,
>> Matt
>>
>>
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Handling exceptions (subject renamed)

2012-10-05 Thread Matt
Hi,

Sorry to anyone who read the original post.
Apparently I had malformed the try block encompassing the create-table in a 
very non-clojure-ish way. 
So my problem wasn't with clojure.java.jdbc's create-table. Being 
'dynamic', clojure could not warn me about it until it crashes in 
runtime. I guess I should also learn more about making exception printouts 
contain more details (such as line number as one, if that's at all 
possible?)
I'd appreciate knowing how to get more details when an exception is caught 
by my code e.g. at least a line number if possible -

I was using - 
*(catch Exception e (println (str "Exception is: " e)))*

Which only yielded a general description (java.lang.ClassCastException: 
clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn) without 
indicating where my code broke.

Is it possible to get the source line that made the code break?

Thanks!

On Friday, October 5, 2012 5:15:18 PM UTC+2, Matt wrote:
>
> Hi,
>
> I'm relatively new to Clojure. This must be easy.
> I am trying to write a function that creates a table with a name passed as 
> argument, and this naturally requires passing *
> clojure.java.jdbc/create-table *a value for the table name, rather than 
> specifying the name as a constant. However I'm not insofar able to pull it 
> off. 
>
> When I use the form *create-table passed-argument [fields] *as opposed 
> to a constant as in *create-table **:hard-coded-entity-name** [fields]*, 
> then the table gets successfully created in the database, however my code 
> also gets an exception - java.lang.ClassCastException: 
> clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn. 
> The exception is received even though the table had been seemingly 
> perfectly created. I'm probably missing something basic. What do you think 
> can it be?
>
> Thanks,
> Matt
>
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en