Success & Error Handling

34 views
Skip to first unread message

Ari King

unread,
Feb 15, 2013, 1:41:18 PM2/15/13
to shorele...@googlegroups.com
Hi,

I've just started using shoreleave's http-rpc module for remote calls. While I'm able to fetch data, I'm unable to specify success and error handlers via a map in the "remote-callback" function. The following is a simplified code snippet; is there an issue with the code?

(defn search
  []
  (let [query (.val $search)]
    (remote-callback :remote-search
                     ["catalog" query "application/clojure"]
                     {:on-success (fn [data] (.log js/console data)),
                      :on-error (fn [data] (.log js/console data))})))

Paul deGrandis

unread,
Feb 15, 2013, 2:06:36 PM2/15/13
to shorele...@googlegroups.com
Hi Ari,

That looks correct to me.  Typically, I use the macros and not the direct functions.

What results are you seeing?

Cheers,
Paul

Ari King

unread,
Feb 17, 2013, 6:10:53 PM2/17/13
to shorele...@googlegroups.com

Hi Ari,

That looks correct to me.  Typically, I use the macros and not the direct functions.

What results are you seeing?

Cheers,
Paul

Hi Paul,

I'm not seeing results of any kind. Neither the success nor error handler are called, moreover there are no general javascript errors or warnings. Out of curiosity, why do you generally opt for the macro as opposed to the function?

Best,
Ari 

Paul deGrandis

unread,
Mar 23, 2013, 5:42:32 PM3/23/13
to shorele...@googlegroups.com
I had thought I relied to this, I'm so sorry.

CLJS has to represent keywords as specially formatted strings.  The macro ensures the same representation is used on the server and the client.  Additionally it aids in readability.

Cheers,
Paul
Reply all
Reply to author
Forward
0 new messages