• 请不要在回答技术问题时复制粘贴 AI 生成的内容
rizon
V2EX  ›  程序员

nodejs express 怎么拦截请求过大错误,返回错误信息提示

  •  
  •   rizon ·
    othorizon · Jun 13, 2019 · 1227 views
    This topic created in 2555 days ago, the information mentioned may be changed or developed.

    nodejs express 请求文件过大报错,我想要拦截这个错误信息返回调用方请求过大提示,而不是后台直接报错,不返回数据。
    另外 ajax 请求的错误信息,code 都是 0,http 的返回状态是 413 实体过大,但是 error 里的 code 还是 0, 这是为什么??

    1 replies    2019-06-13 17:00:54 +08:00
    me47587
        1
    me47587  
       Jun 13, 2019
    POST
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3865 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 10:17 · PVG 18:17 · LAX 03:17 · JFK 06:17
    ♥ Do have faith in what you're doing.