Skip to content

#wrap method to wrap error #3

Description

@greyblake

It would be cool to have #wrap or #chain method to wrap error instead of passing it to new.

Example

class MyError
  include Nesty::NestedError
end

begin 
  boooom!
rescue NoMethodError => original_error
  my_error = MyError.custom_method_to_build_error_message(with, number, of, parameters)
  my_error.wrap(original_error)  # That's where I would like to use it
  raise my_error
end

Also I can pass original_error to MyError.custom_method_to_build_error_message as additional parameter but I would prefer avoid doing this to not overload interface with parameters and to make it more reusable.

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions