Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: log the fullMessage with more details about the error #229

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

rigor789
Copy link
Member

If there's a fullMessage on the passed in Error (this comes from NativeScriptException), log that to the console because it includes more info. For example, if a module fails to compile/parse - now we should see the line/column and the file name of the exact location that fails:

Before:

***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught SyntaxError: Invalid or unexpected token
 at 
	require(:1:232)
	at (file:///app/index.js:12:1)
	at require(:1:232)

After:

***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error:

Error calling module function
Cannot compile /Users/rigor789/Library/Developer/CoreSimulator/Devices/EFBBAB23-8AA7-4A85-87D7-A18A78A910FA/data/Containers/Bundle/Application/3F99A2A6-E454-48B9-ADAC-581D191A563C/TestRunner.app/app/test.js
SyntaxError: Invalid or unexpected token
File: (file:///app/test.js:2:17)

StackTrace: 
	require(:1:232)
	at (file:///app/index.js:12:1)
	at require(:1:232)


SyntaxError: Invalid or unexpected token
File: (<unknown>:1:231)

StackTrace: 
	require(:1:232)
	at (file:///app/index.js:12:1)
	at require(:1:232)

Note: the double StackTrace in this example is because these are multiple errors, one from LoadScript and one from LoadModule - the LoadScript one includes the line/col/filename to test.js:2:17 whereas the LoadModule error does not. We can further improve this down the line, since in this example, the 1st stack trace is all we really need... But extra info never hurts...

@cla-bot cla-bot bot added the cla: yes label Sep 23, 2023
@rigor789 rigor789 merged commit d67588c into main Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants