Visual Studio Code中的PHP调试会在每个异常上中断 [英] PHP Debug in Visual Studio Code breaks on every exception

查看:242
本文介绍了Visual Studio Code中的PHP调试会在每个异常上中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始在Visual Studio Code(Ubuntu 14.04)中使用PHP Debug扩展。对于我来说,它通常可以正常工作,但是我有一个问题,每次抛出异常时,调试器都会自动中断。我们有很多异常在内部被捕获并在代码中处理,因此我不想遍历每个异常。



我一直在尝试查找类似于


I am just starting to use the PHP Debug extension in Visual Studio Code (Ubuntu 14.04). It mostly works fine for me, but I have a problem that every time an exception is thrown, the debugger automatically breaks. We have lots of exceptions which are internally caught and handled in our code, so I don't want to have to step through each of these.

I've been trying to find something like the Exception Settings in Visual Studio 2015, but can't find any equivalent options within Visual Studio Code.

php.ini settings:

[debug]
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000

Visual Studio Code launch.json:

{
   "version": "0.2.0",
   "configurations": [      
       {
           "name": "Launch currently open script",
           "type": "php",
           "request": "launch",
           "program": "${file}",
           "cwd": "${fileDirname}",
           "port": 9000,
           "args": ["some arguments"]
       }
   ]
}

Note that when I use Netbeans for debugging with the same xdebug settings and the same codebase, there is no break-on-exception behaviour, so I think this must be something in Visual Studio Code and/or the PHP Debug extension.

Can anyone suggest how to pass through exceptions without breaking?

解决方案

I've just found the answer myself (feeling a little stupid now!).

In Visual Studio Code, go to View->Debug, then uncheck the 'Everything' button in the Breakpoints section. That option will automatically break on PHP Notices, Warnings and Exceptions.

这篇关于Visual Studio Code中的PHP调试会在每个异常上中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆