Skip to content
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

feat: Don't panic when api impl is nil #6857

Merged
merged 1 commit into from
Jul 26, 2021

Conversation

placer14
Copy link
Contributor

(fixes #6632)

curl -X POST -i -H "Content-Type: application/json" --data '{ "jsonrpc": "2.0", "id":1, "method": "Filecoin.MpoolGetNonce", "params": [ "t1mps3lifbqregwqnfbcyjlllectulzgchbhsvomy" ] }' 'http://127.0.0.1:2346/rpc/v0'
HTTP/1.1 200 OK
Date: Fri, 23 Jul 2021 23:17:42 GMT
Content-Length: 77
Content-Type: text/plain; charset=utf-8

{"jsonrpc":"2.0","id":1,"error":{"code":1,"message":"method not supported"}}

@placer14 placer14 requested a review from a team as a code owner July 23, 2021 23:21
@placer14
Copy link
Contributor Author

This removes the panicking, BUT it's unclear how to manage the HTTP status code and the error code returned in the payload. This also checks in the artifacts from make gen. LMK if another process handles this and should be removed from this PR.

@placer14 placer14 force-pushed the mg/feat/graceful-lite-api-w-missing-methods branch from 61e2f33 to 4937f1f Compare July 23, 2021 23:23
@magik6k
Copy link
Contributor

magik6k commented Jul 26, 2021

Http 200 code is correct even for method-not-found jsonrpc errors. We could use https://github.com/filecoin-project/go-jsonrpc/pull/36/files to return error codes, but I don't think that's necessary

This also checks in the artifacts from make gen

That's good, those are meant to be checked in

@magik6k magik6k force-pushed the mg/feat/graceful-lite-api-w-missing-methods branch from 4937f1f to 76a9f42 Compare July 26, 2021 11:51
Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a nice improvement

@magik6k magik6k enabled auto-merge July 26, 2021 11:58
@magik6k magik6k disabled auto-merge July 26, 2021 12:02
@magik6k magik6k merged commit 11d3f19 into master Jul 26, 2021
@magik6k magik6k deleted the mg/feat/graceful-lite-api-w-missing-methods branch July 26, 2021 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dont panic when calling a method that is not supported by lotus gateway
2 participants