Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions crashlytics/src/IOSImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal class IOSImpl : Impl

[DllImport("__Internal")]
private static extern void CLURecordCustomException(string name, string reason,
Frame[] frames, int frameCount);
Frame[] frames, int frameCount, bool isOnDemand);

[DllImport("__Internal")]
private static extern bool CLUIsCrashlyticsCollectionEnabled();
Expand Down Expand Up @@ -96,7 +96,12 @@ public override void SetUserId(string identifier)
public override void LogException(Exception exception)
{
var loggedException = LoggedException.FromException(exception);
RecordCustomException(loggedException);
RecordCustomException(loggedException, false);
}

public override void LogExceptionAsFatal(Exception exception) {
var loggedException = LoggedException.FromException(exception);
RecordCustomException(loggedException, true);
}

public override bool IsCrashlyticsCollectionEnabled() {
Expand All @@ -108,7 +113,7 @@ public override void SetCrashlyticsCollectionEnabled(bool enabled) {
}

// private void RecordCustomException(string name, string reason, string stackTraceString)
private void RecordCustomException(LoggedException loggedException) {
private void RecordCustomException(LoggedException loggedException, bool isOnDemand) {
Dictionary<string, string>[] parsedStackTrace = loggedException.ParsedStackTrace;

List<Frame> frames = new List<Frame>();
Expand All @@ -121,7 +126,7 @@ private void RecordCustomException(LoggedException loggedException) {
});
}

CLURecordCustomException(loggedException.Name, loggedException.Message, frames.ToArray(), frames.Count);
CLURecordCustomException(loggedException.Name, loggedException.Message, frames.ToArray(), frames.Count, isOnDemand);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
@property(nonatomic, strong, nullable) NSString* developmentPlatformName;
@property(nonatomic, strong, nullable) NSString* developmentPlatformVersion;

- (void)recordOnDemandExceptionModel:(FIRExceptionModel* _Nonnull)exceptionModel;
@end

void FIRCLSUserLoggingRecordInternalKeyValue(NSString* key, id value);
2 changes: 1 addition & 1 deletion crashlytics/src/cpp/ios/CrashlyticsiOSWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ typedef struct Frame {
// to used to log NSException objects. All safely-reportable NSExceptions are
// automatically captured by Crashlytics.
void CLURecordCustomException(const char *name, const char *reason,
Frame *frames, int frameCount);
Frame *frames, int frameCount, bool isOnDemand);

// Returns true when the Crashlytics SDK is initialized.
bool CLUIsInitialized();
Expand Down
6 changes: 5 additions & 1 deletion crashlytics/src/cpp/ios/CrashlyticsiOSWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ - (BOOL)isCrashlyticsStarted;

#pragma mark Main API

void CLURecordCustomException(const char *name, const char *reason, Frame *frames, int frameCount) {
void CLURecordCustomException(const char *name, const char *reason, Frame *frames, int frameCount, bool isOnDemand) {
NSString *nameString = safeCharToNSString(name);
NSString *reasonString = safeCharToNSString(reason);
NSMutableArray<FIRStackFrame *> *framesArray = [NSMutableArray arrayWithCapacity:frameCount];
Expand All @@ -57,6 +57,10 @@ void CLURecordCustomException(const char *name, const char *reason, Frame *frame
[FIRExceptionModel exceptionModelWithName:nameString reason:reasonString];
model.stackTrace = framesArray;

if (isOnDemand) {
[[FIRCrashlytics crashlytics] recordOnDemandExceptionModel:model];
return;
}
[[FIRCrashlytics crashlytics] recordExceptionModel:model];
}

Expand Down