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

Throw an error on duplicate registration #7729

Merged
merged 10 commits into from
Oct 29, 2020
Merged

Throw an error on duplicate registration #7729

merged 10 commits into from
Oct 29, 2020

Conversation

amaury1093
Copy link
Contributor

Description

closes: #7679


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

// we panic).
foundImplType, found := imap[typeURL]
if found && foundImplType != implType {
panic(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry Robert, it's hard not to panic here. I think we need to change the signature of RegisterInterfaces everywhere on AppModuleBasic, if we don't want to panic.

@codecov
Copy link

codecov bot commented Oct 29, 2020

Codecov Report

Merging #7729 into master will increase coverage by 0.03%.
The diff coverage is 96.87%.

@@            Coverage Diff             @@
##           master    #7729      +/-   ##
==========================================
+ Coverage   54.17%   54.21%   +0.03%     
==========================================
  Files         611      611              
  Lines       38624    38654      +30     
==========================================
+ Hits        20926    20956      +30     
  Misses      15564    15564              
  Partials     2134     2134              

@amaury1093 amaury1093 marked this pull request as ready for review October 29, 2020 13:00
Copy link
Member

@aaronc aaronc left a comment

Choose a reason for hiding this comment

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

Let's also have a comment for RegisterCustomTypeURL and maybe explain why it's an error to register services twice (that means conflicting modules usually)

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

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

Splendid - ACKd!

@amaury1093
Copy link
Contributor Author

amaury1093 commented Oct 29, 2020

I added clearer messages in the panics, feel free to suggest some better wording.

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Oct 29, 2020
@mergify mergify bot merged commit 9087ffc into master Oct 29, 2020
@mergify mergify bot deleted the am-7679-twice branch October 29, 2020 15:32
clevinson pushed a commit that referenced this pull request Oct 29, 2020
* Panic on registering a service twice

* Panic if we register twice

* Fix test

* Fix test

* Add clearer panic message

* Add comment

* Fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Encoding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Registering protobuf service or interface type twice should cause an error
3 participants