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

fix: Send response with 404 status when quering non-exist account #14

Merged
merged 1 commit into from
Jul 10, 2020
Merged

fix: Send response with 404 status when quering non-exist account #14

merged 1 commit into from
Jul 10, 2020

Conversation

kukugi
Copy link
Contributor

@kukugi kukugi commented Jul 9, 2020

Description

Mapping error and http status to send a reponse with proper http status
in this PR, map a one error. but, to be mapped all of errors

Motivation and context

https://github.com/line/link/issues/286

How has this been tested?

TBD

Screenshots (if appropriate):

Checklist:

  • I followed the contributing guidelines.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@kukugi kukugi requested review from wetcod, whylee259, hsyis and kfangw July 9, 2020 10:55
type HTTPStatusMappingTable map[string]map[uint32]int

var (
table = HTTPStatusMappingTable{
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM.
However, For better structure, you'd better consider below when you work on next PR

  1. Do not use a constant value like 9 here. It is an error code and should be provided as a variable or named constant by the error definition.
  2. Provide register function which maps given error to HTTP status. If then, in each module when the error is registered the HTTP status code can be passed also.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM.
However, For better structure, you'd better consider below when you work on next PR

  1. Do not use a constant value like 9 here. It is an error code and should be provided as a variable or named constant by the error definition.
  2. Provide register function which maps given error to HTTP status. If then, in each module when the error is registered the HTTP status code can be passed also.

👍

Can we do 1 like the below?

		errors.RootCodespace: {
			errors.ErrUnknownAddress.ABCICode(): http.StatusNotFound,
		},

@kfangw
Copy link
Contributor

kfangw commented Jul 10, 2020

If line/link ran CI with the version tag 0.0.1 already, it should be bumped up 0.0.2
If not, the CI encounter problem for the conflict of hash value of go.sum file.
@whylee259

@whylee259
Copy link
Contributor

If line/link ran CI with the version tag 0.0.1 already, it should be bumped up 0.0.2
If not, the CI encounter problem for the conflict of hash value of go.sum file.
@whylee259

The CI has already run with tag 0.0.1. we may bump up the version.

@kukugi kukugi merged commit 7bdbf03 into Finschia:develop Jul 10, 2020
@egonspace egonspace mentioned this pull request Mar 22, 2021
9 tasks
egonspace pushed a commit that referenced this pull request Mar 23, 2021
* feat: add codespace to broadcast response (#6)

* chore: expose usedCodes for document (#7)

* fix: query error (#9)

* fix: check internalABCICodespace  (#10)

* fix: check UndefinedCodespace too

* Update types/errors/abci.go

Co-authored-by: Yongwoo Lee <[email protected]>

Co-authored-by: Yongwoo Lee <[email protected]>

* fix: Send response with 404 status when quering non-exist account (#14)

* chore: enable github action ci

* chore: remove github access token from Dockerfile

Co-authored-by: Yongwoo Lee <[email protected]>
Co-authored-by: Marshall Kim <[email protected]>
Co-authored-by: wonkuk_seo <[email protected]>
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.

3 participants