Skip to content

Improve Error Message on ServiceUnavailable #14

Open
@AlexCatarino

Description

@AlexCatarino

Expected Behavior

When the service is unavailable, Lean adds this information to the runtime error.

Actual Behavior

When the service is unavailable, Lean creates a brokerage message:
Error - Code: ServiceUnavailable - - Brokerage: TradierBrokerage
but the runtime error is raised by the following API call, which can return an empty message. This results in the following message:
Runtime Error:

Capture

syslog:

2022-09-22T23:41:32.4135621Z ERROR:: TradierBrokerage.Execute.accounts/6YA23301/orders(2): Parameters:  Response: <?xml version='1.0' encoding='UTF-8'?><fault><faultstring>Gateway Timeout</faultstring><detail><errorcode>messaging.adaptors.http.flow.GatewayTimeout</errorcode></detail></fault>
[  ...  Attempts to reconnect ... ]
2022-09-22T23:42:17.1942707Z ERROR:: Brokerage.OnMessage(): Error - Code: ServiceUnavailable - 
2022-09-22T23:42:17.1975736Z TRACE:: CloudLiveTradingResultHandler.BrokerageMessage(): Error - Code: ServiceUnavailable -  - Brokerage: TradierBrokerage
2022-09-22T23:42:17.2036159Z ERROR:: Extensions.SetRuntimeError(): Extensions.SetRuntimeError(): RuntimeError at 9/22/2022 11:42:16 PM UTC. Context: Brokerage Error System.Exception
2022-09-22T23:42:17.2764612Z TRACE:: Tradier.FetchOrders(): No orders found
2022-09-22T23:42:17.6945296Z ERROR:: TradierBrokerage.Execute.accounts/6YA23301/orders(2): Parameters:  Response: 
2022-09-22T23:42:17.6945789Z TRACE:: TradierBrokerage.Execute.accounts/6YA23301/orders(2): Attempting again...
2022-09-22T23:42:17.8017087Z ERROR:: AlgorithmManager.Run(): Stopping, encountered a runtime error at 9/22/2022 11:42:17 PM UTC.

System Information

Live trading in QuantConnect Cloud.

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions