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

Introduce new error handling convention #635

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Nov 6, 2023

  1. Return Result<Self, Self::Err> in FromStr impls

    If we return `Self, Self::Err` then the implementations of `FromStr` are
    easier to maintain.
    tcharding committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    c5b6226 View commit details
    Browse the repository at this point in the history
  2. Move associated type to top of impl

    As is customary put the associated type at the start of the `FromStr`
    impl block.
    tcharding committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    ebfb3e2 View commit details
    Browse the repository at this point in the history
  3. Move hex code to new submodule

    In preparation for adding separate errors move the hex code to its own
    private module.
    tcharding committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    ec02f3f View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2023

  1. Add PreallocatedBuffer

    Add a wrapper type `PreallocatedBuffer` that maintains the invariant
    that the inner buffer is big enough. This allows us to take this as a
    parameter for preallocated context constructors and remove the error
    path.
    tcharding committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    08c330f View commit details
    Browse the repository at this point in the history
  2. Use TryFrom in SharedSecret::from_slice

    Using `TryFrom` is more terse with no loss of clarity.
    
    Refactor only, no logic changes.
    tcharding committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    7bd28e1 View commit details
    Browse the repository at this point in the history
  3. Split general error into specific

    Currently we have a large general error type.
    
    Create specific error types for each function as needed so that a
    function returns ever variant available in its return type.
    tcharding committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    4e72db6 View commit details
    Browse the repository at this point in the history