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

Make Http status mapping registrable #16

Closed
wants to merge 1 commit into from
Closed

Make Http status mapping registrable #16

wants to merge 1 commit into from

Conversation

kukugi
Copy link
Contributor

@kukugi kukugi commented Aug 13, 2020

Next step of #14

Description

Two changes for mapping http status and error

1.Make a mapping http status and error registrable using error instance.
2.Remove hard-coded error code.

@kukugi kukugi requested a review from kfangw August 13, 2020 05:53
@kukugi kukugi self-assigned this Aug 13, 2020
"reflect"

"github.com/cosmos/cosmos-sdk/types/rest"
Copy link
Contributor

Choose a reason for hiding this comment

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

It causes cyclic import

@@ -87,6 +89,10 @@ var (
ErrPanic = Register(UndefinedCodespace, 111222, "panic")
)

func init() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function needed to be moved to the rest package

@@ -87,6 +89,10 @@ var (
ErrPanic = Register(UndefinedCodespace, 111222, "panic")
)

func init() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to use init ?
IMO, the table can be filled in static time.

Copy link
Contributor Author

@kukugi kukugi Aug 18, 2020

Choose a reason for hiding this comment

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

add init for mapping error using RegisterHttpStatusMapping
then, is it ok to fill the table like

var (
	table = HTTPStatusMappingTable{
		errors.RootCodespace: {
			errors.ErrUnknownAddress.ABCICode(): http.StatusNotFound,
		},
	}
)

this? (in rest package) (i think it can solve two problem above also)

Copy link
Contributor

Choose a reason for hiding this comment

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

please make the commit for it so that let me see what you intended.

@kukugi
Copy link
Contributor Author

kukugi commented Aug 18, 2020

@kfangw thanks for your review.
fix a problem commented

@kfangw kfangw closed this Sep 24, 2020
0Tech pushed a commit to 0Tech/finschia-sdk that referenced this pull request Jul 22, 2022
Fix the bug that should be used `operator` address when `to` address is nil on CreateFTClass
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.

2 participants