null_backend.go 620 B

1234567891011121314151617181920
  1. package honeybadger
  2. // nullBackend implements the Backend interface but swallows errors and does not
  3. // send them to Honeybadger.
  4. type nullBackend struct{}
  5. // Ensure nullBackend implements Backend.
  6. var _ Backend = &nullBackend{}
  7. // NewNullBackend creates a backend which swallows all errors and does not send
  8. // them to Honeybadger. This is useful for development and testing to disable
  9. // sending unnecessary errors.
  10. func NewNullBackend() Backend {
  11. return nullBackend{}
  12. }
  13. // Notify swallows error reports, does nothing, and returns no error.
  14. func (b nullBackend) Notify(_ Feature, _ Payload) error {
  15. return nil
  16. }