/// <summary> /// Write out any error details received from the Oculus SDK, into the debug output window. /// Please note that writing text to the debug output window is a slow operation and will affect performance, /// if too many messages are written in a short timespan. /// </summary> /// <param name="oculus">OculusWrap object for which the error occurred.</param> /// <param name="message">Error message to include in the debug text.</param> public static void WriteErrorDetails(Wrap oculus, string message) { // Retrieve the error message from the last occurring error. OVRTypes.ErrorInfo errorInformation = oculus.GetLastError(); string formattedMessage = string.Format("{0}. \nMessage: {1} (Error code={2})", message, errorInformation.ErrorString, errorInformation.Result); Console.WriteLine(formattedMessage); }
/// <summary> /// Write out any error details received from the Oculus SDK, into the debug output window. /// Please note that writing text to the debug output window is a slow operation and will affect performance, /// if too many messages are written in a short timespan. /// </summary> /// <param name="oculus">OculusWrap object for which the error occurred.</param> /// <param name="result">Error code to write in the debug text.</param> /// <param name="message">Error message to include in the debug text.</param> public static void WriteErrorDetails(Wrap oculus, OVRTypes.Result result, string message) { if (result >= OVRTypes.Result.Success) { return; } // Retrieve the error message from the last occurring error. OVRTypes.ErrorInfo errorInformation = oculus.GetLastError(); string formattedMessage = string.Format("{0}. \nMessage: {1} (Error code={2})", message, errorInformation.ErrorString, errorInformation.Result); throw new Exception(formattedMessage); }
void AssertSuccess(OVRTypes.Result result, Wrap oculus, string message) { if (result >= OVRTypes.Result.Success) { return; } // Retrieve the error message from the last occurring error. OVRTypes.ErrorInfo errorInformation = oculus.GetLastError(); string formattedMessage = string.Format("{0}. Message: {1} (Error code={2})", message, errorInformation.ErrorString, errorInformation.Result); Trace.WriteLine(formattedMessage); throw new HeadsetError(formattedMessage); }