bad argument in call when: curl -H POST -d @file

75 views
Skip to first unread message

dmitri...@gmail.com

unread,
Sep 6, 2014, 8:21:42 PM9/6/14
to chica...@googlegroups.com
Command:
curl -H POST -d @file localhost:8001/action

controller is:
index('POST', []) ->
  ok.

I ger error:
04:17:14.974 [error] gen_server <0.282.0> terminated with reason: bad argument in call to erlang:list_to_atom(undefined) in boss_router_controller:route/2 line 174

This line is 
ControllerModule = list_to_atom(boss_files:web_controller(App, C, State#state.controllers)),

and this: boss_files:web_controller(App, C, State#state.controllers)
actually return undefined

Any idea how to fix it?
Thanks

Dmitry Polyanovsky

unread,
Sep 7, 2014, 1:53:43 AM9/7/14
to chica...@googlegroups.com
Hi,
you should call host/controller/action and not just host/action

also, for better understanding you  need to show your routes file


--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/8c20f826-27c5-487d-bbbe-9bd3c3d70fbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dmitrii Golub

unread,
Sep 7, 2014, 12:24:48 PM9/7/14
to chica...@googlegroups.com
Thanks for your resposne. I found the problem.
It is in trailing slash in the url.

Here is the route file:

{"/action", [{application, fast_cp}, {controller, "fast_cp_some_controller"}, {action, "index"}]}.

If I enter /action/ then it's ok.
however /action raise exception

Jesse Gumm

unread,
Sep 7, 2014, 12:28:22 PM9/7/14
to chica...@googlegroups.com
Ahh, that makes sense in light if your routes file.

Since the first argument to each routes is a regular expression, you
could match on an optional trailing slash by adding /? to the first
arg and it would work both ways

{"/action/?", [{application, fast_cp}, {controller,
"fast_cp_some_controller"}, {action, "index"}]}.

-Jesse
> https://groups.google.com/d/msgid/chicagoboss/559c519d-b456-449e-8db7-781556626b4f%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Dmitrii Golub

unread,
Sep 7, 2014, 2:53:02 PM9/7/14
to chica...@googlegroups.com
Thanks a lot!
Reply all
Reply to author
Forward
0 new messages