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

Allow the component and action to also be set by the library #87

Merged
merged 7 commits into from
Aug 14, 2019

Conversation

sixlive
Copy link
Collaborator

@sixlive sixlive commented Jul 20, 2019

Description

By allowing the component and action to be set by the context as well as the additional parameters we can leverage it to easily set the component and action for the Laravel library.

$badger = Honeybadger::new([
    'api_key' => 'asdf',
    'handlers' => [
        'exception' => false,
        'error' => false,
    ],
], $client->make());

$badger->setComponent('HomeController');
$badger->setAction('index');

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Steps to Test or Reproduce

Outline the steps to test or reproduce the PR here.

> git pull --prune
> git checkout <branch>
> vendor/bin/phpunit

@sixlive sixlive requested a review from joshuap July 20, 2019 17:34
@sixlive sixlive self-assigned this Jul 20, 2019
Copy link
Member

@joshuap joshuap left a comment

Choose a reason for hiding this comment

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

This approach works for me. We have a similar approach for tags in our Ruby gem, where you can set the tags key in the context and those tags will get added to the error. This will basically add action and component as "special" keys for PHP context. We'll just need to be sure it's clearly documented so that people aren't surprised when using component as an arbitrary key in their context changes their error grouping. :)

@sixlive
Copy link
Collaborator Author

sixlive commented Jul 22, 2019

Maybe we should prefix them with honeybadger_ ?

@joshuap
Copy link
Member

joshuap commented Jul 22, 2019

Yeah, I could go for that. Do you think we should delete the from the context when reading them, so they don't appear in the context section?

@sixlive
Copy link
Collaborator Author

sixlive commented Aug 13, 2019

@joshuap I made it much more simple. I added a setComponent and setAction method to the Honeybadger object. This still uses context under the hood but once we were talking about prefixing I didn't want to have to expose that implementation detail to a consumer. I also updated it so that we strip these values from the context since it really doesn't make sense to be in 2 places.

@sixlive sixlive requested a review from joshuap August 13, 2019 20:49
Copy link
Member

@joshuap joshuap left a comment

Choose a reason for hiding this comment

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

Works for me. Thanks!

@sixlive sixlive changed the title Allow the component and action to also be set by the context Allow the component and action to also be set by the library Aug 13, 2019
sixlive added a commit to sixlive/honeybadger-laravel that referenced this pull request Aug 13, 2019
@sixlive sixlive merged commit 8b20ab3 into honeybadger-io:master Aug 14, 2019
sixlive added a commit to honeybadger-io/honeybadger-laravel that referenced this pull request Sep 4, 2019
* Adds controller and action to the context

* Updates implementation based on honeybadger-io/honeybadger-php#87

* Added changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants