Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Improve Error Handling by Adding Display Implementations #140

Merged
merged 3 commits into from
Sep 21, 2023

Conversation

b3hr4d
Copy link
Contributor

@b3hr4d b3hr4d commented Sep 21, 2023

This pull request aims to improve the error-handling mechanism of the codebase by providing more descriptive error messages. It involves changes across multiple files (cell.rs, log.rs) to add implementations for the fmt::Display trait for InitError.

Key Changes:

  1. Consistent Formatting: Replaced std::fmt with fmt to maintain consistency in the code.

    • File: btreemap.rs
  2. Enhanced Error Messages for InitError in cell.rs:

    • Describes errors related to incompatible versions and value sizes.
  3. Detailed Error Messages for InitError in log.rs:

    • Explains issues with incompatible data and index versions, as well as invalid indices.

Why this is important:

Better error messages enhance the debugging experience and allow developers to understand the issues quickly, thereby saving time and effort.

Files Changed:

  • src/btreemap.rs
  • src/cell.rs
  • src/log.rs

Types of changes:

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

@b3hr4d b3hr4d requested review from roman-kashitsyn and a team as code owners September 21, 2023 09:51
@ghost
Copy link

ghost commented Sep 21, 2023

Dear @b3hr4d,

In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA1.

If you decide to agree with it, please visit this issue and read the instructions there.

— The DFINITY Foundation

Footnotes

  1. Contributor License Agreement

@ghost
Copy link

ghost commented Sep 21, 2023

Dear @b3hr4d,

In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA1.

If you decide to agree with it, please visit this issue and read the instructions there.

— The DFINITY Foundation

Footnotes

  1. Contributor License Agreement

@ghost
Copy link

ghost commented Sep 21, 2023

Dear @b3hr4d,

In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA1.

If you decide to agree with it, please visit this issue and read the instructions there.

— The DFINITY Foundation

Footnotes

  1. Contributor License Agreement

@b3hr4d b3hr4d changed the title Add missing Display impl for InitError Improve Error Handling by Adding Display Implementations Sep 21, 2023
@ielashi ielashi changed the title Improve Error Handling by Adding Display Implementations feat: Improve Error Handling by Adding Display Implementations Sep 21, 2023
Copy link
Contributor

@ielashi ielashi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@ielashi
Copy link
Contributor

ielashi commented Sep 21, 2023

@b3hr4d I think you need to sign the CLA for us to be able to merge this commit.

@b3hr4d
Copy link
Contributor Author

b3hr4d commented Sep 21, 2023

@b3hr4d I think you need to sign the CLA for us to be able to merge this commit.

I, b3hr4d, hereby agree to the DFINITY Foundation's CLA.

@ielashi ielashi enabled auto-merge (squash) September 21, 2023 11:17
@ielashi ielashi merged commit 0375df2 into dfinity:main Sep 21, 2023
3 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants