/// <summary> /// The utility method to check for an error. Returns false on failure and throws an exception. /// </summary> /// <returns>Returns true in case of no error, otherwise false.</returns> internal static bool ThrowIfFailed(this Interop.ErrorCode err, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) { if (err.IsFailed()) { Log.Error(LogTag, $"{msg}, err: {err.ToString()}", file, func, line); throw err.GetException(msg); } return(true); }