Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c278430

Browse filesBrowse files
authored
fix(core): unhandled error typings (#10320)
NativeScriptError type def used to come from packages/core/global-types.d.ts now comes from packages/core/application/application-interfaces.ts, so fixed there now.
1 parent 0873894 commit c278430
Copy full SHA for c278430

File tree

Expand file treeCollapse file tree

2 files changed

+13
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-5
lines changed

‎apps/automated/src/main.ts

Copy file name to clipboardExpand all lines: apps/automated/src/main.ts
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ Application.on(Application.lowMemoryEvent, function (args: ApplicationEventData)
8080
// Error events.
8181
Application.on(Application.uncaughtErrorEvent, function (args: UnhandledErrorEventData) {
8282
console.log('NativeScriptError:', args.error);
83-
console.log((<any>args.error).nativeException ?? (<any>args.error).nativeError);
84-
console.log((<any>args.error).stackTrace ?? (<any>args.error).stack);
83+
console.log(args.error.nativeException ?? (<any>args.error).nativeError);
84+
console.log(args.error.stackTrace ?? args.error.stack);
8585
});
8686

8787
Application.on(Application.discardedErrorEvent, function (args: DiscardedErrorEventData) {
8888
console.log('[Discarded] NativeScriptError:', args.error);
89-
console.log((<any>args.error).nativeException ?? (<any>args.error).nativeError);
90-
console.log((<any>args.error).stackTrace ?? (<any>args.error).stack);
89+
console.log(args.error.nativeException ?? (<any>args.error).nativeError);
90+
console.log(args.error.stackTrace ?? args.error.stack);
9191
});
9292

9393
// Android activity events.

‎packages/core/application/application-interfaces.ts

Copy file name to clipboardExpand all lines: packages/core/application/application-interfaces.ts
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ export interface NativeScriptError extends Error {
99
/**
1010
* Represents the native error object.
1111
*/
12-
nativeError: any;
12+
nativeException?: any;
13+
/**
14+
* The native stack trace.
15+
*/
16+
stackTrace?: string;
17+
/**
18+
* Javascript portion of stack trace.
19+
*/
20+
stack?: string;
1321
}
1422

1523
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.