Jaymon / endpoints

Lightweight REST api backend framework that automatically maps urls to python modules and classes
MIT License
29 stars 10 forks source link

This error should be more descriptive #48

Closed Jaymon closed 7 years ago

Jaymon commented 8 years ago

while calling an endpoint defined like this:

class Foo(Controller):
    def bar(self, **kwargs): pass

with this url

/foo/bar/che

Then che will correctly return 404 and cause this error to be logged:

POST() takes exactly 1 argument (2 given)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/endpoints/call.py", line 373, in handle
    body = self.handle_controller(callback, callback_args, callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/endpoints/call.py", line 319, in handle_controller
    body = callback(*callback_args, **callback_kwargs)
TypeError: POST() takes exactly 1 argument (2 given)

But it would be way nicer for it to print out what is causing this, for example, something like:

path bits [che] caused 404