Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
82cdef7
feat: support chaining errors
ahmedAlaaInstabug Jul 24, 2025
c4aca95
feat: support chaining errors
ahmedAlaaInstabug Jul 24, 2025
32a506e
feat: support chaining errors
ahmedAlaaInstabug Jul 24, 2025
2716489
sanity: v16.0.0
ahmedAlaaInstabug Aug 13, 2025
5920584
[GER-7366] Support App variant (#1409)
ahmedAlaaInstabug Aug 13, 2025
2963ad6
snapshot: fix upload sourcemap on ios (#1423)
ahmedAlaaInstabug Aug 13, 2025
7698dce
fix: private views
ahmedAlaaInstabug Aug 13, 2025
aa17639
fix: change log
ahmedAlaaInstabug Aug 13, 2025
2d52d8d
fix: masking private views
ahmedAlaaInstabug Aug 13, 2025
27c46cc
Merge remote-tracking branch 'origin/sanity/v16.0.0' into sanity/v16.0.0
ahmedAlaaInstabug Aug 13, 2025
fed6c49
fix: masking private views
ahmedAlaaInstabug Aug 13, 2025
e45f316
feat: Support Advanced UI customization (#1411)
AyaMahmoud148 Aug 14, 2025
b6089f8
bump ios SDK to 16.0.1
ahmedAlaaInstabug Aug 14, 2025
fb1bd69
bump ios SDK to 16.0.1
ahmedAlaaInstabug Aug 14, 2025
fc55abe
fix: conflict with RN-health dependency
ahmedAlaaInstabug Aug 25, 2025
882bcfd
feat: remove deprecated APis
ahmedAlaaInstabug Aug 14, 2025
c14658a
feat: support expo updates (#1391)
kholood-ea Aug 18, 2025
b1644e6
fix: CHANGELOG.md
ahmedAlaaInstabug Aug 18, 2025
6afec12
feat: expo-sourcemap-support (#1392)
ahmedAlaaInstabug Aug 19, 2025
a48ef52
fix: expo-plugin (#1438)
ahmedAlaaInstabug Aug 19, 2025
12ae119
chore: bump ios SDK to v16.0.2
ahmedAlaaInstabug Aug 20, 2025
2b32f5c
fix: sample app
ahmedAlaaInstabug Aug 27, 2025
c55b198
Merge branch 'sanity/v16.0.0' into fix/conflict-with-health-dependancy
ahmedAlaaInstabug Aug 29, 2025
6743e69
fix CHANGELOG.md
ahmedAlaaInstabug Aug 29, 2025
6c6a9e0
Merge pull request #1446 from Instabug/fix/conflict-with-health-depen…
ahmedAlaaInstabug Aug 29, 2025
4d1c818
ci: fix custom release package (#1445)
ahmedAlaaInstabug Aug 29, 2025
2a6f0a7
Merge pull request #1436 from Instabug/sanity/v16.0.0
ahmedAlaaInstabug Aug 31, 2025
1d4059b
Merge branch 'dev' into feat/support-chaining-erros
ahmedAlaaInstabug Sep 16, 2025
64e62bf
Merge branch 'master' into feat/support-chaining-erros
ahmedAlaaInstabug Sep 16, 2025
e526cb0
Release:v16.0.4
ahmedAlaaInstabug Oct 23, 2025
cd4b238
Release:v16.0.4
ahmedAlaaInstabug Oct 23, 2025
bb1db25
Merge pull request #1417 from Instabug/feat/support-chaining-erros
ahmedAlaaInstabug Oct 23, 2025
0493490
ci: ignore android e2e testing (#1458)
ahmedAlaaInstabug Oct 26, 2025
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [16.0.4](https://github.com/Instabug/Instabug-React-Native/compare/v16.0.4...dev)

### Added

- Add support for chaining errors . ([#1417](https://github.com/Instabug/Instabug-React-Native/pull/1417))

## [16.0.3](https://github.com/Instabug/Instabug-React-Native/compare/v16.0.3...dev)

### Changed
Expand Down
4 changes: 2 additions & 2 deletions examples/default/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNInstabug (16.0.3):
- RNInstabug (16.0.4):
- Instabug (= 16.0.3)
- React-Core
- RNReanimated (3.16.1):
Expand Down Expand Up @@ -2090,7 +2090,7 @@ SPEC CHECKSUMS:
ReactCommon: 6a952e50c2a4b694731d7682aaa6c79bc156e4ad
RNCClipboard: 2821ac938ef46f736a8de0c8814845dde2dcbdfb
RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8
RNInstabug: 0b04c724acc081f0da864470f4f296dfc5c933ca
RNInstabug: 35e4ac525227429fc1f22fa7dd069f317d69f86e
RNReanimated: f42a5044d121d68e91680caacb0293f4274228eb
RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958
RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d
Expand Down
30 changes: 30 additions & 0 deletions examples/default/src/screens/CrashReportingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ export const CrashReportingScreen: React.FC = () => {
throw error;
}
}

function throwUnhandledChainingException(error: Error, isPromise: boolean = false) {
const appName = 'Instabug Test App';
const rejectionType = isPromise ? 'Promise Rejection ' : '';
const errorMessage = `Unhandled ${rejectionType}${error.name} from ${appName}`;

if (!error.message) {
console.log(`IBG-CRSH | Error message: ${error.message}`);
error.message = errorMessage;
}

if (isPromise) {
console.log('IBG-CRSH | Promise');
Promise.reject(error).then(() =>
Alert.alert(`Promise Rejection Crash report for ${error.name} is Sent!`),
);
} else {
try {
throw ReferenceError();
} catch (e) {
error.cause = e;
throw error;
}
}
}

const [isEnabled, setIsEnabled] = useState(false);

const [userAttributeKey, setUserAttributeKey] = useState('');
Expand Down Expand Up @@ -216,6 +242,10 @@ export const CrashReportingScreen: React.FC = () => {
title="Throw Unhandled Syntax Exception"
onPress={() => throwUnhandledException(new SyntaxError())}
/>
<ListTile
title="Throw Unhandled Chaining Exception"
onPress={() => throwUnhandledChainingException(new SyntaxError('level 1 SyntaxError'))}
/>
<ListTile
title="Throw Unhandled Range Exception"
onPress={() => throwUnhandledException(new RangeError())}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "instabug-reactnative",
"description": "React Native plugin for integrating the Instabug SDK",
"version": "16.0.3",
"version": "16.0.4",
"author": "Instabug (https://instabug.com)",
"repository": "github:Instabug/Instabug-React-Native",
"homepage": "https://www.instabug.com/platforms/react-native",
Expand Down
11 changes: 11 additions & 0 deletions src/native/NativeCrashReporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,20 @@ export interface CrashData {
os: (typeof Platform)['OS'];
platform: 'react_native';
exception: StackFrame[];
cause_crash?: CauseCrashData;
}

export interface CauseCrashData {
message: string;
e_message: string;
e_name: string;
exception: StackFrame[];
cause_crash?: CauseCrashData;
}

export interface CrashReportingNativeModule extends NativeModule {
setEnabled(isEnabled: boolean): void;

sendJSCrash(data: CrashData | string): Promise<void>;

sendHandledJSCrash(
Expand All @@ -23,6 +33,7 @@ export interface CrashReportingNativeModule extends NativeModule {
fingerprint?: string | null,
nonFatalExceptionLevel?: NonFatalErrorLevel | null,
): Promise<void>;

setNDKCrashesEnabled(isEnabled: boolean): Promise<void>;
}

Expand Down
19 changes: 18 additions & 1 deletion src/utils/InstabugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import parseErrorStackLib, {
import type { NavigationState as NavigationStateV5, PartialState } from '@react-navigation/native';
import type { NavigationState as NavigationStateV4 } from 'react-navigation';

import type { CrashData } from '../native/NativeCrashReporting';
import type { CauseCrashData, CrashData } from '../native/NativeCrashReporting';
import { NativeCrashReporting } from '../native/NativeCrashReporting';
import type { NetworkData } from './XhrNetworkInterceptor';
import { NativeInstabug } from '../native/NativeInstabug';
Expand Down Expand Up @@ -59,6 +59,23 @@ export const getCrashDataFromError = (error: Error) => {
platform: 'react_native',
exception: jsStackTrace,
};
// Recursively attach inner_crash objects (up to 3 levels)
let currentError: any = error;
let level = 0;
let parentCrash: CauseCrashData | CrashData = jsonObject;
while (currentError.cause && level < 3) {
const cause = currentError.cause as Error;
const innerCrash: CauseCrashData = {
message: `${cause.name} - ${cause.message}`,
e_message: cause.message,
e_name: cause.name,
exception: getStackTrace(cause),
};
parentCrash.cause_crash = innerCrash;
parentCrash = innerCrash;
currentError = cause;
level++;
}
return jsonObject;
};

Expand Down
59 changes: 59 additions & 0 deletions test/utils/InstabugUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,65 @@ describe('Instabug Utils', () => {
NonFatalErrorLevel.error,
);
});
it('getCrashDataFromError should include one level of cause crash', () => {
const causeError = new TypeError('Cause error');
const rootError = new Error('Root error');
(rootError as any).cause = causeError;

const crashData = InstabugUtils.getCrashDataFromError(rootError);
const jsStackTraceRootError = InstabugUtils.getStackTrace(rootError);
const jsStackTraceCauseError = InstabugUtils.getStackTrace(causeError);

expect(crashData.message).toBe('Error - Root error');
expect(crashData.e_message).toBe('Root error');
expect(crashData.e_name).toBe('Error');
expect(crashData.platform).toBe('react_native');
expect(crashData.exception).toEqual(jsStackTraceRootError);
expect(crashData.cause_crash).toBeDefined();
expect(crashData.cause_crash?.message).toBe('TypeError - Cause error');
expect(crashData.cause_crash?.e_name).toBe('TypeError');
expect(crashData.cause_crash?.exception).toEqual(jsStackTraceCauseError);
});

it('getCrashDataFromError should include up to 3 levels of cause crash', () => {
const errorLevel3 = new Error('Third level error');
const errorLevel2 = new Error('Second level error');
const errorLevel1 = new Error('First level error');
const rootError = new Error('Root error');

(errorLevel2 as any).cause = errorLevel3;
(errorLevel1 as any).cause = errorLevel2;
(rootError as any).cause = errorLevel1;

const crashData = InstabugUtils.getCrashDataFromError(rootError);

expect(crashData.message).toBe('Error - Root error');
expect(crashData.cause_crash?.message).toBe('Error - First level error');
expect(crashData.cause_crash?.cause_crash?.message).toBe('Error - Second level error');
expect(crashData.cause_crash?.cause_crash?.cause_crash?.message).toBe(
'Error - Third level error',
);
expect(crashData.cause_crash?.cause_crash?.cause_crash?.cause_crash).toBeUndefined();
});

it('getCrashDataFromError should stop at 3 levels even if more causes exist', () => {
const errorLevel4 = new Error('Fourth level error');
const errorLevel3 = new Error('Third level error');
const errorLevel2 = new Error('Second level error');
const errorLevel1 = new Error('First level error');
const rootError = new Error('Root error');

(errorLevel3 as any).cause = errorLevel4;
(errorLevel2 as any).cause = errorLevel3;
(errorLevel1 as any).cause = errorLevel2;
(rootError as any).cause = errorLevel1;

const crashData = InstabugUtils.getCrashDataFromError(rootError);

const thirdLevel = crashData.cause_crash?.cause_crash?.cause_crash;
expect(thirdLevel?.message).toBe('Error - Third level error');
expect(thirdLevel?.cause_crash).toBeUndefined(); // should not include 4th level
});
});

describe('reportNetworkLog', () => {
Expand Down