In my case Oanda Brokerage Model (for CFD) returned Market On Open as Invalid, Is there a way to catch invalid orders so that I can cancel submitted stop loss and take profit orders. 

Order = self.Transactions.GetOrderById(OrderEvent.OrderId)
# Cancel Stop loss and take profit pending orders if market order is invalid
        
if OrderEvent.Status == OrderStatus.Invalid:
	if Order.Tag == "Long_Entry":
    	self.long_tp_order.Cancel()
        self.long_sl_order.Cancel()
    elif Order.Tag == "Short_Entry":
    	self.short_tp_order.Cancel() 
        self.short_sl_order.Cancel() 

I am doing this but unable to catch it, I think the OrderStatus.Invalid string does not match with OrderEvent.Status,