了解节点ReferenceError转储

时间:2018-10-20 21:27:14

标签: node.js error-handling runtime-error

试图通过了解错误转储更好地了解如何进行调试。例如,我的参考错误如下:

ReferenceError: Can't find variable: title

This error is located at:
    in TimerForm (at ToggleTimerForm.js:44)
    in RCTView (at View.js:60)
    in View (at ToggleTimerForm.js:42)
    in ToggleableTimerForm (at App.js:54)
    in RCTView (at View.js:60)
    in View (at ScrollView.js:791)
    in RCTScrollView (at ScrollView.js:887)
    in ScrollView (at App.js:53)
    in RCTView (at View.js:60)
    in View (at App.js:47)
    in App (at registerRootComponent.js:35)
    in RootErrorBoundary (at registerRootComponent.js:34)
    in ExpoRootComponent (at renderApplication.js:33)
    in RCTView (at View.js:60)
    in View (at AppContainer.js:102)
    in RCTView (at View.js:60)
    in View (at AppContainer.js:122)
    in AppContainer (at renderApplication.js:32)

* components/TimerForm.js:54:6 in render
- node_modules/react-proxy/modules/createPrototypeProxy.js:44:35 in proxiedMethod
- node_modules/react-native/Libraries/Renderer/ReactNativeRenderer-dev.js:8811:23 in finishClassComponent
- ... 17 more stack frames from framework internals

本能地,我首先看到的是TimerForm,但是随后我看到ToggleTimerForm.js也被列出。 “在”是什么意思,“在”是什么意思?另外,为什么列出了这么多文件?它们在此错误转储中有什么意义?

很想更好地了解这一切的原理!

1 个答案:

答案 0 :(得分:1)

这基本上只是一个call stack,是相互调用的函数链。通常,您希望查看最新的错误信息,但是通常您可能需要向上几个层次才能理解其逻辑。

请注意,根据框架的不同,调用堆栈可能以不同的方式显示。在这种情况下,您看到的是react调用堆栈,而不是普通的node.js。