Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

feat!: create an error instance from code and required data #342

Merged
merged 11 commits into from
Sep 7, 2021

Conversation

shumkov
Copy link
Member

@shumkov shumkov commented Aug 26, 2021

Issue being fixed or feature implemented

To pass only necessary data to the client and allow to recreate error instances from a code and additional required information we should implement:

  • Errors require only minimal necessary information
  • DPP provides a method to create an error from a code and the required info
  • Errors provide a method to extract this information

What was done?

  • Added missing consensus errors
  • Passed only necessary information to consensus error constructors, additional information (for logging) added with setters
  • Added AbstractConsensusError#getConstructorArguments() method to return information necesarry to reinstantiate an error
  • Made ConsensusError class abstract
  • Implemented createConsenusError function
  • Test error codes

How Has This Been Tested?

With integration and unit tests

Breaking Changes

Some validation errors are changed.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@shumkov shumkov added this to the v0.21.0 milestone Sep 1, 2021
@shumkov shumkov changed the title Error necessary data feat: create an error instance from code and required data Sep 1, 2021
@shumkov shumkov changed the title feat: create an error instance from code and required data feat!: create an error instance from code and required data Sep 1, 2021
@shumkov shumkov marked this pull request as ready for review September 1, 2021 15:04
Copy link
Contributor

@jawid-h jawid-h left a comment

Choose a reason for hiding this comment

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

Looks legit

@shumkov shumkov merged commit 4370e48 into v0.21-dev Sep 7, 2021
@shumkov shumkov deleted the error-necessary-data branch October 12, 2021 12:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants