What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Any idea, why console commands aren't failing in case of exceptions?

U01LKKBK97T
U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

Any idea, why console commands aren't failing in case of exceptions?

Comments

  • Alexander Veselov
    Alexander Veselov Sprykee Posts: 9 πŸ§‘πŸ»β€πŸš€ - Cadet

    probably something catches exceptions

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    Nope. Seems like a core issue.

  • USZ0XG6SK
    USZ0XG6SK Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited March 2021

    which console commands are you talking about? data:import commands for example have -t option to throw the exceptions.

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    It's a custom one extending AbstractDataConsole.

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    -t doesn't help in this case.

  • USZ0XG6SK
    USZ0XG6SK Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet

    are the commands executed by some bash script? If yes, maybe you want set -e

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    We're executing it like this: docker/sdk console data:validate

  • USZ0XG6SK
    USZ0XG6SK Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet

    there is also a global flag in configuration which you can set ConsoleConstants::CATCH_EXCEPTIONS

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    I'll check later, thanks.

  • USZ0XG6SK
    USZ0XG6SK Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited March 2021

    you can see the specification in vendor/spryker/console/src/Spryker/Shared/Console/ConsoleConstants.php

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    Had to add

    $config[ConsoleConstants::CATCH_EXCEPTIONS] = true;
    

    to config.
    The value is a bit misleading, since I don't want it to catch them but rather raise them. Nevertheless, it's working.
    Thanks guys.