codeduan
V2EX  ›  编程

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

  •  
  •   codeduan · Apr 23, 2020 · 4077 views
    This topic created in 2228 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   ·   2577 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 01:12 · PVG 09:12 · LAX 18:12 · JFK 21:12
    ♥ Do have faith in what you're doing.