BugsnagEvent

Objective-C


@interface BugsnagEvent
    : NSObject <BugsnagFeatureFlagStore, BugsnagMetadataStore>

Swift

class BugsnagEvent : NSObject, BugsnagFeatureFlagStore, BugsnagMetadataStore

Represents an occurrence of an error, along with information about the state of the app and device.

  • A loose representation of what was happening in the application at the time of the event

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *context;

    Swift

    var context: String? { get set }
  • The severity of the error generating the report

    Declaration

    Objective-C

    @property (nonatomic) BSGSeverity severity;

    Swift

    var severity: BSGSeverity { get set }
  • Information extracted from the error that caused the event. The list contains at least one error that represents the root cause, with subsequent elements populated from the cause.

    Declaration

    Objective-C

    @property (nonatomic, copy, nonnull) NSArray<BugsnagError *> *errors;

    Swift

    var errors: [BugsnagError] { get set }
  • Customized hash for grouping this report with other errors

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *groupingHash;

    Swift

    var groupingHash: String? { get set }
  • Breadcrumbs from user events leading up to the error

    Declaration

    Objective-C

    @property (nonatomic, copy, nonnull) NSArray<BugsnagBreadcrumb *> *breadcrumbs;

    Swift

    var breadcrumbs: [BugsnagBreadcrumb] { get set }
  • Feature flags that were active when the error occurred

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nonnull) NSArray<BugsnagFeatureFlag *> *featureFlags;

    Swift

    var featureFlags: [BugsnagFeatureFlag] { get }
  • A per-event override for the apiKey.

    • The default value of nil results in the BugsnagConfiguration apiKey being used.
    • Writes are not persisted to BugsnagConfiguration.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *apiKey;

    Swift

    var apiKey: String? { get set }
  • Device information such as OS name and version

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) BugsnagDeviceWithState *device;

    Swift

    var device: BugsnagDeviceWithState { get }
  • app

    App information such as the name, version, and bundle ID

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) BugsnagAppWithState *app;

    Swift

    var app: BugsnagAppWithState { get }
  • Whether the event was a crash (i.e. unhandled) or handled error in which the system continued running.

    Declaration

    Objective-C

    @property (nonatomic) BOOL unhandled;

    Swift

    var unhandled: Bool { get set }
  • Thread traces for the error that occurred, if collection was enabled.

    Declaration

    Objective-C

    @property (nonatomic, copy, nonnull) NSArray<BugsnagThread *> *threads;

    Swift

    var threads: [BugsnagThread] { get set }
  • The original object that caused the error in your application. This value will only be populated for non-fatal errors which did not terminate the process, and will contain an NSError or NSException.

    Manipulating this field does not affect the error information reported to the Bugsnag dashboard. Use event.errors to access and amend the representation of the error that will be sent.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) id originalError;

    Swift

    var originalError: Any? { get set }
  • The current user

    Declaration

    Objective-C

    @property (nonatomic, readonly, nonnull) BugsnagUser *user;

    Swift

    var user: BugsnagUser { get }
  • Set user metadata

    Declaration

    Objective-C

    - (void)setUser:(NSString *_Nullable)userId
          withEmail:(NSString *_Nullable)email
            andName:(NSString *_Nullable)name;

    Swift

    func setUser(_ userId: String?, withEmail email: String?, andName name: String?)

    Parameters

    userId

    ID of the user

    name

    Name of the user

    email

    Email address of the user