Skip to content

[Messenger] Add previous to the exception output #20133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fabpot opened this issue Aug 19, 2024 · 2 comments
Closed

[Messenger] Add previous to the exception output #20133

fabpot opened this issue Aug 19, 2024 · 2 comments
Milestone

Comments

@fabpot
Copy link
Member

fabpot commented Aug 19, 2024

Q A
Feature PR symfony/symfony#52951
PR author(s) @ToshY
Merged in 7.2

We created this issue to not forget to document this new feature. We would really appreciate if you can help us with this task. If you are not sure how to do it, please ask us and we will help you.

To fix this issue, please create a PR against the 7.2 branch in the symfony-docs repository.

Thank you! 😃

@fabpot fabpot added this to the 7.2 milestone Aug 19, 2024
@ToshY
Copy link
Contributor

ToshY commented Aug 19, 2024

Hey @fabpot 👋

I'd love to help out but I'm not sure what actually should be documented. The feature in symfony/symfony#52951 was to add $previous to the exception in the messenger:failed:show command for easier debugging, and currently the messenger docs only show the messenger:failed:show being used in the section Saving & Retrying Failed Messages and it does not show how it's actually actually displayed (in the terminal).

Should this PR then be a complete example on how the output of the command for a failed message looks like in general?

Example bin/console messenger:failed:show 1 -vvv
> Loading messages from the global failure transport failed.
> To use a different failure transport, pass --transport=.
> Available failure transports are: failed, failed_important


There are 2 messages pending in the failure transport.

Failed Message Details
======================

 ------------- ---------------------------------------------------------
  Class         App\Message\TestMessage
  Message Id    1
  Failed at     2024-12-31 12:00:00
  Error         Oops, something went wrong!
  Error Code    0
  Error Class   App\Exception\CustomException
  Transport     async
 ------------- ---------------------------------------------------------

 Message history:
  * Message failed at 2024-12-31 12:00:57 and was redelivered
  * Message failed at 2024-12-31 12:01:51 and was redelivered
  * Message failed at 2024-12-31 12:02:52 and was redelivered
  * Message failed at 2024-12-31 12:04:27 and was redelivered

Message:
========

App\Message\TestMessage^ {
  -id: 1234
}

Exception:
==========

Symfony\Component\HttpClient\Exception\TimeoutException^ {
  message: "Idle timeout reached for "https://google.com/"."
  code: 0
  file: "/app/vendor/symfony/http-client/Chunk/ErrorChunk.php"
  line: 56
  trace: {
    /app/vendor/symfony/http-client/Chunk/ErrorChunk.php:56 { …}
    /app/vendor/symfony/http-client/Response/AsyncResponse.php:79 { …}
    /app/vendor/symfony/http-client/Response/CommonResponseTrait.php:144 { …}
    /app/vendor/symfony/http-client/Response/AsyncResponse.php:98 { …}
    /app/src/Service/TestService.php:35 {
      App\Service\TestService->request(string $url): array^
      ›
      › try {
      ›     $statusCode = $response->getStatusCode();
      › } catch (TransportExceptionInterface $e) {
      ›     throw new \App\Exception\CustomException('Oops, something went wrong!', $e->getCode(), $e);
      › }
    }
    /app/src/Service/TestService.php:356 { …}
    /app/vendor/symfony/cache/LockRegistry.php:111 { …}
    /app/vendor/symfony/cache/Traits/ContractsTrait.php:102 { …}
    /app/vendor/symfony/cache-contracts/CacheTrait.php:64 { …}
    /app/vendor/symfony/cache/Traits/ContractsTrait.php:85 { …}
    /app/vendor/symfony/cache-contracts/CacheTrait.php:30 { …}
    /app/src/MessageHandler/TestMessageHandler.php:50 { …}
    /app/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php:152 { …}
    /app/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php:91 { …}
    /app/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php:71 { …}
    /app/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php:34 { …}
    /app/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php:68 { …}
    /app/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php:41 { …}
    /app/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php:37 { …}
    /app/vendor/symfony/messenger/MessageBus.php:70 { …}
    /app/vendor/symfony/messenger/RoutableMessageBus.php:54 { …}
    /app/vendor/symfony/messenger/Worker.php:162 { …}
    /app/vendor/symfony/messenger/Worker.php:109 { …}
    /app/vendor/symfony/messenger/Command/ConsumeMessagesCommand.php:235 { …}
    /app/vendor/symfony/console/Command/Command.php:279 { …}
    /app/vendor/symfony/console/Application.php:1047 { …}
    /app/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
    /app/vendor/symfony/console/Application.php:316 { …}
    /app/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
    /app/vendor/symfony/console/Application.php:167 { …}
    /app/bin/console:43 { …}
  }
  previous: TimeoutException^ {
    message: """
      Idle timeout reached for "https://google.com/".
      """
    code: 0
    file: "/app/src/Service/TestService.php"
    line: 36
    trace: {
      ...
  }
}

 Run messenger:failed:retry 1 --transport=failed to retry this message.
 Run messenger:failed:remove 1 --transport=failed to delete it.

@xabbuh
Copy link
Member

xabbuh commented Aug 20, 2024

I don't think we need to document the change in the output.

@xabbuh xabbuh closed this as not planned Won't fix, can't repro, duplicate, stale Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants