Skip to content

Request: Make exceptions subclass from a single parent class #332

Description

@Roguelazer

Right now, if you want to handle exceptions, your choices are to thread through a block to every single function call, or to do weird import gymnastics to get at the hidden codegen modules.

If the various ApiError types all subclassed from a single public exception (something like Hubspot::BaseException), it'd be much more straightforward to use normal Ruby exception handling.

What I'm doing for now is basically

begin
  # do lots of hubspot stuff
rescue => exc
  raise exc unless exc.class.name.match?(/\AHubspot::.*ApiError\z/)
  # handle hubspot exceptions
end

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions