Skip to content

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

@Roguelazer

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

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