guanguans / laravel-exception-notify

Monitor exception and report it to notification channels(Dump、Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、Zulip).
MIT License
122 stars 11 forks source link

vscode打开项目提示如下错误 #55

Closed zwping closed 7 months ago

zwping commented 8 months ago

laravel 10.33 laravel-exception-notify 3.5.0

"Exception Basic": {
        "class": "Symfony/Component/Console/Exception/RuntimeException",
        "message": "The /"--columns/" option does not exist.",
        "code": 0,
        "file": "vendor/symfony/console/Input/ArgvInput.php",
        "line": 223
    },
    "Exception Context": {
        "  214": "    /**",
        "  215": "     * Adds a long option value.",
        "  216": "     *",
        "  217": "     * @throws RuntimeException When option given doesn't exist",
        "  218": "     */",
        "  219": "    private function addLongOption(string $name, mixed $value): void",
        "  220": "    {",
        "  221": "        if (!$this->definition->hasOption($name)) {",
        "  222": "            if (!$this->definition->hasNegation($name)) {",
        "➤ 223": "                throw new RuntimeException(sprintf('The /"--%s/" option does not exist.', $name));",
        "  224": "            }",
        "  225": "",
        "  226": "            $optionName = $this->definition->negationToName($name);",
        "  227": "            if (null !== $value) {",
        "  228": "                throw new RuntimeException(sprintf('The /"--%s/" option does not accept a value.', $name));",
        "  229": "            }",
        "  230": "            $this->options[$optionName] = false;",
        "  231": "",
        "  232": "            return;",
        "  233": "        }"
    },
    "Exception Trace": {
        "10": "#10 artisan(35): Illuminate/Foundation/Console/Kernel->handle(Object(Symfony/Component/Console/Input/ArgvInput), Object(Symfony/Component/Console/Output/ConsoleOutput))",
        "11": "#11 {main}"
    },
create-issue-branch[bot] commented 8 months ago

Branch issue-55-vscode打开项目提示如下错误 created!

guanguans commented 8 months ago

@zwping 这是正常的吧。你去看laravel的错误日志去看对应的错误。

Issues-translate-bot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@zwping This is normal. Go to laravel's error log to see the response errors.

zwping commented 8 months ago

非正常吧,很尬的现象是,每次启动项目通知一下异常群?

Issues-translate-bot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It's not normal, right? The embarrassing phenomenon is that every time the project is started, the abnormal group is notified?

zwping commented 8 months ago

这是完整的日志,目前将其加入了except避免了这个现象

Issues-translate-bot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This is the complete log. Currently, it is added to except to avoid this phenomenon.

zwping commented 8 months ago

大佬能否剖析下vs启动laravel的过程,优化下这个现象?

Issues-translate-bot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Can you guys analyze the process of starting Laravel in VS and optimize this phenomenon?

guanguans commented 8 months ago

非正常吧,很尬的现象是,每次启动项目通知一下异常群?

猜想是因为 vscode 启动的时候一些插件什么的执行了一些错误的命令或者什么,行为默认是和 laravel 的报错保持一致的,laravel 里面有报错,这里就有报错提醒了。

最好是检查你的编辑器每次启动执行了什么错误的命令。

当然也可以通过配置仅生产或者测试环境就好了,或者排除掉你那个具体异常的报告。

<?php

return [
    ...
    'env' => env_explode('EXCEPTION_NOTIFY_ENV', [
        'production',
        // 'local',
        'testing',
        // '*',
    ]),

    'except' => [
        // 那个具体的异常类
        // Illuminate\Http\Exceptions\HttpResponseException::class,
    ],
    ...
];
zwping commented 8 months ago

ok

harryqt commented 8 months ago

Having the exact same issue. Opening vscode causing notification to trigger.

[2024-01-21 12:12:36] local.ERROR: The "--columns" option does not exist. {"exception":"[object] (Symfony\\Component\\Console\\Exception\\RuntimeException(code: 0): The \"--columns\" option does not exist. at /Users/harry/Projects/laratest/vendor/symfony/console/Input/ArgvInput.php:223)
[stacktrace]
#0 /Users/harry/Projects/laratest/vendor/symfony/console/Input/ArgvInput.php(150): Symfony\\Component\\Console\\Input\\ArgvInput->addLongOption('columns', 'name,action')
#1 /Users/harry/Projects/laratest/vendor/symfony/console/Input/ArgvInput.php(85): Symfony\\Component\\Console\\Input\\ArgvInput->parseLongOption('--columns=name,...')
#2 /Users/harry/Projects/laratest/vendor/symfony/console/Input/ArgvInput.php(74): Symfony\\Component\\Console\\Input\\ArgvInput->parseToken('--columns=name,...', true)
#3 /Users/harry/Projects/laratest/vendor/symfony/console/Input/Input.php(56): Symfony\\Component\\Console\\Input\\ArgvInput->parse()
#4 /Users/harry/Projects/laratest/vendor/symfony/console/Command/Command.php(285): Symfony\\Component\\Console\\Input\\Input->bind(Object(Symfony\\Component\\Console\\Input\\InputDefinition))
#5 /Users/harry/Projects/laratest/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#6 /Users/harry/Projects/laratest/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#7 /Users/harry/Projects/laratest/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Foundation\\Console\\RouteListCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#8 /Users/harry/Projects/laratest/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#9 /Users/harry/Projects/laratest/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#10 /Users/harry/Projects/laratest/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#11 {main}
"} 
guanguans commented 8 months ago

Having the exact same issue. Opening vscode causing notification to trigger.

[2024-01-21 12:12:36] local.ERROR: The "--columns" option does not exist. {"exception":"[object] (Symfony\\Component\\Console\\Exception\\RuntimeException(code: 0): The \"--columns\" option does not exist. at /Users/harry/Projects/laratest/vendor/symfony/console/Input/ArgvInput.php:223)
[stacktrace]
#0 /Users/harry/Projects/laratest/vendor/symfony/console/Input/ArgvInput.php(150): Symfony\\Component\\Console\\Input\\ArgvInput->addLongOption('columns', 'name,action')
#1 /Users/harry/Projects/laratest/vendor/symfony/console/Input/ArgvInput.php(85): Symfony\\Component\\Console\\Input\\ArgvInput->parseLongOption('--columns=name,...')
#2 /Users/harry/Projects/laratest/vendor/symfony/console/Input/ArgvInput.php(74): Symfony\\Component\\Console\\Input\\ArgvInput->parseToken('--columns=name,...', true)
#3 /Users/harry/Projects/laratest/vendor/symfony/console/Input/Input.php(56): Symfony\\Component\\Console\\Input\\ArgvInput->parse()
#4 /Users/harry/Projects/laratest/vendor/symfony/console/Command/Command.php(285): Symfony\\Component\\Console\\Input\\Input->bind(Object(Symfony\\Component\\Console\\Input\\InputDefinition))
#5 /Users/harry/Projects/laratest/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#6 /Users/harry/Projects/laratest/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#7 /Users/harry/Projects/laratest/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Foundation\\Console\\RouteListCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#8 /Users/harry/Projects/laratest/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#9 /Users/harry/Projects/laratest/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#10 /Users/harry/Projects/laratest/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#11 {main}
"} 

My guess is that some plugin or something executed some wrong command or something when vscode started up. The default behavior is consistent with the error reported by Laravel. There is an error reported in Laravel, so here is the error alert.

It is best to check what error commands are executed every time your editor starts.

You can also configure only the production or testing environment, or exclude your specific exception report.

<?php

return [
    ...
    'env' => env_explode('EXCEPTION_NOTIFY_ENV', [
        'production',
        // 'local',
        'testing',
        // '*',
    ]),

    'except' => [
        // The exception class
        // Symfony\Component\Console\Exception\RuntimeException::class,
    ],
    ...
];
harryqt commented 7 months ago

My guess is that some plugin or something executed some wrong command or something when vscode started up.

Found the culprit, it is causing by Laravel Goto extension causing by Line 41

harryqt commented 7 months ago

This is fixed now. You can close it.