V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
codeduan
V2EX  ›  编程

请教一个 JS 异常处理和代码执行的问题

  •  
  •   codeduan · Apr 23, 2020 · 4021 views
    This topic created in 2195 days ago, the information mentioned may be changed or developed.

    代码是: setInterval(function() { throw "error" }, 1000)

    在浏览器中会不断地执行,即使抛出异常。但是在 Nodejs 中抛出异常后就不执行了。我一直以为 Node 也会一直执行。请问这个问题那里有详细的说明?

    1 replies    2020-04-23 23:45:52 +08:00
    codeduan
        1
    codeduan  
    OP
       Apr 23, 2020
    好像在 Nodejs 里出现没处理的异常就会终止程序。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1819 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 16:22 · PVG 00:22 · LAX 09:22 · JFK 12:22
    ♥ Do have faith in what you're doing.