Skip to content

Commit be5f1fe

Browse files
Add Swift API for recording errors with userInfo parameters (#8816)
1 parent 2ea640a commit be5f1fe

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Crashlytics/Crashlytics/FIRCrashlytics.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,11 @@ - (void)setDevelopmentPlatformVersion:(NSString *)developmentPlatformVersion {
351351

352352
#pragma mark - API: Errors and Exceptions
353353
- (void)recordError:(NSError *)error {
354-
FIRCLSUserLoggingRecordError(error, nil);
354+
[self recordError:error userInfo:nil];
355+
}
356+
357+
- (void)recordError:(NSError *)error userInfo:(NSDictionary<NSString *, id> *)userInfo {
358+
FIRCLSUserLoggingRecordError(error, userInfo);
355359
}
356360

357361
- (void)recordExceptionModel:(FIRExceptionModel *)exceptionModel {

Crashlytics/Crashlytics/Public/FirebaseCrashlytics/FIRCrashlytics.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,21 @@ NS_SWIFT_NAME(Crashlytics)
118118
*/
119119
- (void)recordError:(NSError *)error NS_SWIFT_NAME(record(error:));
120120
121+
/**
122+
* Records a non-fatal event described by an NSError object. The events are
123+
* grouped and displayed similarly to crashes. Keep in mind that this method can be expensive.
124+
* The total number of NSErrors that can be recorded during your app's life-cycle is limited by a
125+
* fixed-size circular buffer. If the buffer is overrun, the oldest data is dropped. Errors are
126+
* relayed to Crashlytics on a subsequent launch of your application.
127+
*
128+
* @param error Non-fatal error to be recorded
129+
* @param userInfo Additional keys and values to send with the logged error. These parameters are
130+
* added to Crashlytics global list of keys and values that live with the session.
131+
*/
132+
- (void)recordError:(NSError *)error
133+
userInfo:(nullable NSDictionary<NSString *, id> *)userInfo
134+
NS_SWIFT_NAME(record(error:userInfo:));
135+
121136
/**
122137
* Records an Exception Model described by an ExceptionModel object. The events are
123138
* grouped and displayed similarly to crashes. Keep in mind that this method can be expensive.

0 commit comments

Comments
 (0)