Skip to content
This repository was archived by the owner on Sep 14, 2020. It is now read-only.

Commit 83cf568

Browse files
Merge branch 'master' into api-key-plist-fix
2 parents 84ab0de + a437a77 commit 83cf568

12 files changed

Lines changed: 121 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
Changelog
22
=========
33

4+
## 2.9.4 (2018-05-02)
5+
6+
* Enable nativeSerializer to handle Error objects by extracting the stack and message from a given Error class before serialising it. [#239](https://github.com/bugsnag/bugsnag-react-native/issues/239) [#240](https://github.com/bugsnag/bugsnag-react-native/pull/240) [daisy1754](https://github.com/daisy1754) [Cawllec](https://github.com/Cawllec)
7+
8+
* Upgrade bugsnag-android to v4.3.4:
9+
- *Bug Fixes:*
10+
- Avoid adding extra comma separator in JSON if File input is empty or null [#284](https://github.com/bugsnag/bugsnag-android/pull/284)
11+
- Thread safety fixes to JSON file serialisation [#295](https://github.com/bugsnag/bugsnag-android/pull/295)
12+
- Prevent potential automatic activity lifecycle breadcrumb crash [#300](https://github.com/bugsnag/bugsnag-android/pull/300)
13+
- Fix serialisation issue with leading to incorrect dashboard display of breadcrumbs [#306](https://github.com/bugsnag/bugsnag-android/pull/306)
14+
- Prevent duplicate reports being delivered in low connectivity situations [#270](https://github.com/bugsnag/bugsnag-android/pull/270)
15+
- Fix possible NPE when reading default metadata filters [#263](https://github.com/bugsnag/bugsnag-android/pull/263)
16+
- Prevent ConcurrentModificationException in Before notify/breadcrumb callbacks [#266](https://github.com/bugsnag/bugsnag-android/pull/266)
17+
- Ensure that exception message is never null [#256](https://github.com/bugsnag/bugsnag-android/pull/256)
18+
- Add payload version to JSON body [#244](https://github.com/bugsnag/bugsnag-android/pull/244)
19+
- Update context tracking to use lifecycle callbacks rather than ActivityManager [#238](https://github.com/bugsnag/bugsnag-android/pull/238)
20+
- *Enhancements:*
21+
- Detect whether running on emulator [#245](https://github.com/bugsnag/bugsnag-android/pull/245)
22+
- Add a callback for filtering breadcrumbs [#237](https://github.com/bugsnag/bugsnag-android/pull/237)
23+
* Upgrade bugsnag-cocoa to v5.15.5:
24+
- *Bug Fixes:*
25+
- Changes report generation so that when a minimal or incomplete crash is recorded, essential app/device information is included in the report on the next application launch. [#239](https://github.com/bugsnag/bugsnag-cocoa/pull/239)
26+
[#250](https://github.com/bugsnag/bugsnag-cocoa/pull/250)
27+
- Ensure timezone is serialised in report payload.
28+
[#248](https://github.com/bugsnag/bugsnag-cocoa/pull/248)
29+
- Ensure error class and message are persisted when thread tracing is disabled [#245](https://github.com/bugsnag/bugsnag-cocoa/pull/245)
30+
- Re-addapp name to the app tab of reports [#244](https://github.com/bugsnag/bugsnag-cocoa/pull/244)
31+
- Add payload version to report body to preserve backwards compatibility with older versions of the error reporting API [#241](https://github.com/bugsnag/bugsnag-cocoa/pull/241)
32+
- *Enhancements:*
33+
-This release adds additional device metadata for filtering by whether an error occurred in a simulator ([#242](https://github.com/bugsnag/bugsnag-cocoa/pull/242)) and by processor word size ([#228](https://github.com/bugsnag/bugsnag-cocoa/pull/228)).
34+
435
## 2.9.3 (2018-03-16)
536

637
### Bug Fixes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Bugsnag exception reporter for React Native
2-
[![Documentation](https://img.shields.io/badge/documentation-2.9.3-blue.svg)](http://docs.bugsnag.com/platforms/react-native/)
2+
[![Documentation](https://img.shields.io/badge/documentation-2.9.4-blue.svg)](http://docs.bugsnag.com/platforms/react-native/)
33

44
Automatic [React Native crash reporting](https://www.bugsnag.com/platforms/react-native-error-reporting/) with Bugsnag helps you detect both native OS and JavaScript errors in your React Native apps.
55

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ android {
88
minSdkVersion 16
99
targetSdkVersion 23
1010
versionCode 4
11-
versionName '2.9.3'
11+
versionName '2.9.4'
1212
}
1313
}
1414

1515
dependencies {
16-
compile 'com.bugsnag:bugsnag-android:4.3.1'
16+
compile 'com.bugsnag:bugsnag-android:4.3.4'
1717
compile 'com.facebook.react:react-native:+'
1818
}

cocoa/vendor/bugsnag-cocoa/Source/BugsnagCrashReport.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,10 @@ - (NSDictionary *)toJson {
483483

484484
NSMutableDictionary *appObj = [NSMutableDictionary new];
485485
[appObj addEntriesFromDictionary:self.app];
486-
[appObj addEntriesFromDictionary:self.appState];
486+
487+
for (NSString *key in self.appState) {
488+
BSGDictInsertIfNotNil(appObj, self.appState[key], key);
489+
}
487490

488491
if (self.dsymUUID) {
489492
BSGDictInsertIfNotNil(appObj, @[self.dsymUUID], @"dsymUUIDs");

cocoa/vendor/bugsnag-cocoa/Source/BugsnagKSCrashSysInfoParser.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#import "BugsnagConfiguration.h"
1414
#import "BugsnagLogger.h"
1515

16+
#define PLATFORM_WORD_SIZE sizeof(void*)*8
17+
1618
NSDictionary *BSGParseDevice(NSDictionary *report) {
1719
NSMutableDictionary *device =
1820
[[report valueForKeyPath:@"user.state.deviceState"] mutableCopy];
@@ -22,7 +24,7 @@
2224
BSGDictSetSafeObject(device, [[NSLocale currentLocale] localeIdentifier],
2325
@"locale");
2426

25-
BSGDictSetSafeObject(device, report[@"time_zone"], @"timezone");
27+
BSGDictSetSafeObject(device, [report valueForKeyPath:@"system.time_zone"], @"timezone");
2628
BSGDictSetSafeObject(device, [report valueForKeyPath:@"system.memory.usable"],
2729
@"totalMemory");
2830

@@ -47,6 +49,13 @@
4749
NSNumber *freeBytes = [fileSystemAttrs objectForKey:NSFileSystemFreeSize];
4850
BSGDictSetSafeObject(device, freeBytes, @"freeDisk");
4951
BSGDictSetSafeObject(device, report[@"system"][@"device_app_hash"], @"id");
52+
53+
#if TARGET_OS_SIMULATOR
54+
BSGDictSetSafeObject(device, @YES, @"simulator");
55+
#elif TARGET_OS_IPHONE || TARGET_OS_TV
56+
BSGDictSetSafeObject(device, @NO, @"simulator");
57+
#endif
58+
5059
return device;
5160
}
5261

@@ -62,6 +71,8 @@
6271

6372
BSGDictSetSafeObject(appState, @(activeTimeSinceLaunch),
6473
@"durationInForeground");
74+
75+
BSGDictSetSafeObject(appState, report[BSGKeyExecutableName], BSGKeyName);
6576
BSGDictSetSafeObject(appState,
6677
@(activeTimeSinceLaunch + backgroundTimeSinceLaunch),
6778
@"duration");
@@ -103,6 +114,7 @@
103114
BSGDictSetSafeObject(deviceState, report[@"machine"], @"model");
104115
BSGDictSetSafeObject(deviceState, report[@"system_name"], @"osName");
105116
BSGDictSetSafeObject(deviceState, report[@"system_version"], @"osVersion");
117+
BSGDictSetSafeObject(deviceState, @(PLATFORM_WORD_SIZE), @"wordSize");
106118
BSGDictSetSafeObject(deviceState, @"Apple", @"manufacturer");
107119
BSGDictSetSafeObject(deviceState, report[@"jailbroken"], @"jailbroken");
108120
return deviceState;

cocoa/vendor/bugsnag-cocoa/Source/BugsnagNotifier.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#import <AppKit/AppKit.h>
4242
#endif
4343

44-
NSString *const NOTIFIER_VERSION = @"5.15.3";
44+
NSString *const NOTIFIER_VERSION = @"5.15.5";
4545
NSString *const NOTIFIER_URL = @"https://github.com/bugsnag/bugsnag-cocoa";
4646
NSString *const BSTabCrash = @"crash";
4747
NSString *const BSAttributeDepth = @"depth";

cocoa/vendor/bugsnag-cocoa/Source/BugsnagSink.m

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#import "BugsnagCollections.h"
3030
#import "BugsnagNotifier.h"
3131
#import "BugsnagKeys.h"
32+
#import "BSG_KSSystemInfo.h"
3233

3334
// This is private in Bugsnag, but really we want package private so define
3435
// it here.
@@ -59,9 +60,40 @@ - (void)filterReports:(NSArray *)reports
5960
onCompletion:(BSG_KSCrashReportFilterCompletion)onCompletion {
6061
NSMutableArray *bugsnagReports = [NSMutableArray new];
6162
BugsnagConfiguration *configuration = [Bugsnag configuration];
63+
6264
for (NSDictionary *report in reports) {
63-
BugsnagCrashReport *bugsnagReport =
64-
[[BugsnagCrashReport alloc] initWithKSReport:report];
65+
BugsnagCrashReport *bugsnagReport = [[BugsnagCrashReport alloc] initWithKSReport:report];
66+
BOOL incompleteReport = (![@"standard" isEqualToString:[report valueForKeyPath:@"report.type"]] ||
67+
[[report objectForKey:@"incomplete"] boolValue]);
68+
69+
if (incompleteReport) { // append app/device data as this is unlikely to change between sessions
70+
NSDictionary *sysInfo = [BSG_KSSystemInfo systemInfo];
71+
72+
// reset any existing data as it will be corrupted/nil
73+
bugsnagReport.appState = @{};
74+
bugsnagReport.deviceState = @{};
75+
76+
77+
NSMutableDictionary *appDict = [NSMutableDictionary new];
78+
BSGDictInsertIfNotNil(appDict, sysInfo[@BSG_KSSystemField_BundleVersion], @"bundleVersion");
79+
BSGDictInsertIfNotNil(appDict, sysInfo[@BSG_KSSystemField_BundleID], @"id");
80+
BSGDictInsertIfNotNil(appDict, configuration.releaseStage, @"releaseStage");
81+
BSGDictInsertIfNotNil(appDict, sysInfo[@BSG_KSSystemField_SystemName], @"type");
82+
BSGDictInsertIfNotNil(appDict, sysInfo[@BSG_KSSystemField_BundleShortVersion], @"version");
83+
84+
NSMutableDictionary *deviceDict = [NSMutableDictionary new];
85+
BSGDictInsertIfNotNil(deviceDict, sysInfo[@BSG_KSSystemField_Jailbroken], @"jailbroken");
86+
BSGDictInsertIfNotNil(deviceDict, [[NSLocale currentLocale] localeIdentifier], @"locale");
87+
BSGDictInsertIfNotNil(deviceDict, sysInfo[@"Apple"], @"manufacturer");
88+
BSGDictInsertIfNotNil(deviceDict, sysInfo[@BSG_KSSystemField_Machine], @"model");
89+
BSGDictInsertIfNotNil(deviceDict, sysInfo[@BSG_KSSystemField_Model], @"modelNumber");
90+
BSGDictInsertIfNotNil(deviceDict, sysInfo[@BSG_KSSystemField_SystemName], @"osName");
91+
BSGDictInsertIfNotNil(deviceDict, sysInfo[@BSG_KSSystemField_SystemVersion], @"osVersion");
92+
93+
bugsnagReport.app = appDict;
94+
bugsnagReport.device = deviceDict;
95+
}
96+
6597
if (![bugsnagReport shouldBeSent])
6698
continue;
6799
BOOL shouldSend = YES;
@@ -115,6 +147,7 @@ - (NSDictionary *)getBodyFromReports:(NSArray *)reports {
115147
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
116148
BSGDictSetSafeObject(data, [Bugsnag notifier].details, BSGKeyNotifier);
117149
BSGDictSetSafeObject(data, [Bugsnag notifier].configuration.apiKey, BSGKeyApiKey);
150+
BSGDictSetSafeObject(data, @"4.0", @"payloadVersion");
118151

119152
NSMutableArray *formatted =
120153
[[NSMutableArray alloc] initWithCapacity:[reports count]];

cocoa/vendor/bugsnag-cocoa/Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashReport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,9 +2084,9 @@ void bsg_kscrashreport_writeStandardReport(
20842084
crashContext->config.introspectionRules.enabled,
20852085
crashContext->config.searchThreadNames,
20862086
crashContext->config.searchQueueNames);
2087-
bsg_kscrw_i_writeError(writer, BSG_KSCrashField_Error,
2088-
&crashContext->crash);
20892087
}
2088+
bsg_kscrw_i_writeError(writer, BSG_KSCrashField_Error,
2089+
&crashContext->crash);
20902090
}
20912091
writer->endContainer(writer);
20922092

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
"homepage": "https://www.bugsnag.com/platforms/react-native-error-reporting/",
44
"repository": "https://github.com/bugsnag/bugsnag-react-native.git",
55
"bugs": "https://github.com/bugsnag/bugsnag-react-native/issues",
6-
"version": "2.9.3",
6+
"version": "2.9.4",
77
"license": "MIT",
88
"main": "index.js",
99
"types": "index.d.ts",
1010
"nativePackage": true,
1111
"dependencies": {
12+
"iserror": "^0.0.2",
1213
"promise": "^7",
1314
"prop-types": "^15.6.0"
1415
},

src/NativeSerializer.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const isError = require('iserror')
2+
13
const allowedMapObjectTypes = [ 'string', 'number', 'boolean' ]
24

35
/**
@@ -7,6 +9,9 @@ const allowedMapObjectTypes = [ 'string', 'number', 'boolean' ]
79
const serializeForNativeLayer = (map, maxDepth = 10, depth = 0, seen = new Set()) => {
810
seen.add(map)
911
const output = {}
12+
if (isError(map)) {
13+
map = extractErrorDetails(map)
14+
}
1015
for (const key in map) {
1116
if (!{}.hasOwnProperty.call(map, key)) continue
1217

@@ -35,4 +40,9 @@ const serializeForNativeLayer = (map, maxDepth = 10, depth = 0, seen = new Set()
3540
return output
3641
}
3742

38-
export default serializeForNativeLayer
43+
const extractErrorDetails = (err) => {
44+
const { message, stack, name } = err
45+
return { message, stack, name }
46+
}
47+
48+
module.exports = serializeForNativeLayer

0 commit comments

Comments
 (0)