/// <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. OVR.ovrErrorInfo 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, OVR.ovrResult result, string message) { if (result >= OVR.ovrResult.Success) { return; } // Retrieve the error message from the last occurring error. OVR.ovrErrorInfo errorInformation = oculus.GetLastError(); string formattedMessage = string.Format("{0}. \nMessage: {1} (Error code={2})", message, errorInformation.ErrorString, errorInformation.Result); throw new Exception(formattedMessage); }