Skip to content

Incorrect error stack when throwing from generator function #16107

@madox2

Description

@madox2

Hi, usually when error is logged or thrown in react native I get stack trace like this:

function willLogError() {
  console.error(new Error())
}
willLogError()
Error
    at willLogError (index.android.js:54)
    at index.android.js:56
    at loadModuleImplementation (require.js:174)
    at guardedLoadModule (require.js:119)
    ...

However when I log error from inside generator:

function* willLogError() {
  console.error(new Error())
}
var gen = willLogError()
gen.next()
Error
    at willLogError$ (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:1343:25)
    at tryCatch (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:14373:40)
    at Generator.invoke [as _invoke] (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:14561:22)
    at Generator.prototype.(anonymous function) [as next] (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:14398:21)
    ....

The filepaths in stacktrace contain whole url (http://localhost:8081/...). Chrome is unable to detect source maps for such errors which is giving me a hard time during debugging (for example redux sagas).

I am running it on real android device while remote js debugging.

$ node -v
v8.1.3
$ react-native -v
react-native-cli: 2.0.1
react-native: 0.48.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions