New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw a proper error if negative funds are given to the connect endpoint #1969

Closed
LefterisJP opened this Issue Jul 26, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@LefterisJP
Collaborator

LefterisJP commented Jul 26, 2018

Problem Definition

If you provide negative funds to the connect endpoint like below:

http PUT http://localhost:5001/api/1/connections/0x0f114A1E9Db192502E7856309cc899952b3db1ED funds=-10

then an internal server error is thrown

Traceback (most recent call last):
  File "/home/lefteris/.virtualenvs/raiden/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/lefteris/.virtualenvs/raiden/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/lefteris/.virtualenvs/raiden/lib/python3.6/site-packages/flask_restful/__init__.py", line 480, in wrapper
    resp = resource(*args, **kwargs)
  File "/home/lefteris/.virtualenvs/raiden/lib/python3.6/site-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/lefteris/.virtualenvs/raiden/lib/python3.6/site-packages/flask_restful/__init__.py", line 595, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/home/lefteris/.virtualenvs/raiden/lib/python3.6/site-packages/webargs/core.py", line 441, in wrapper
    return func(*args, **kwargs)
  File "/home/lefteris/ew/raiden/raiden/api/v1/resources.py", line 185, in put
    joinable_funds_target=joinable_funds_target,
  File "/home/lefteris/ew/raiden/raiden/api/rest.py", line 470, in connect
    joinable_funds_target,
  File "/home/lefteris/ew/raiden/raiden/api/python.py", line 163, in token_network_connect
    joinable_funds_target=joinable_funds_target,
  File "/home/lefteris/ew/raiden/raiden/connection_manager.py", line 108, in connect
    raise ValueError('connecting needs a positive value for `funds`')
ValueError: connecting needs a positive value for `funds`

Task

Return a proper error through the API instead of the internal server error

@LefterisJP LefterisJP added this to the Red Eyes Testnet2 milestone Jul 26, 2018

@LefterisJP LefterisJP self-assigned this Jul 26, 2018

@hackaugusto

This comment has been minimized.

Collaborator

hackaugusto commented Jul 26, 2018

@pcppcp does #1959 also fix this?

@LefterisJP

This comment has been minimized.

Collaborator

LefterisJP commented Jul 26, 2018

@hackaugusto no it does not. I am on latest master and just got it. Fix incoming in a few secs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment