Hello,
I want to retrieve more information about the resource causing my ReservationInstance to not get created when calling BookingManager.CreateNewBooking method.
I get the ReservationNotFoundException with the reason of "must be quarantined because Resource X", which is expected, but I want to follow up with a retry mechanism of manipulating booking start or end times to try and correct the action and successfully create the reservation
I wonder if it's possible to get the resource ID in the automation script which is catching this exception.
Any advice is appreciated.
Hi Benjamin,
You can get the resource ID with the following code inside your catch block:
if (e is ResourceManagerTraceDataException exception
&& exception.TraceData?.ErrorData.Count == 1
&& exception.TraceData.ErrorData[0] is ResourceManagerErrorData errorData
&& errorData.ErrorReason == ResourceManagerErrorData.Reason.ReservationUpdateCausedReservationsToGoToQuarantine)
{
var resourceId = errorData.ResourceId;
}
Great! Thank you, Jorge.