Пример #1
0
 /// <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);
 }
Пример #2
0
 /// <summary>
 /// The utility method to check for an error. Returns false on failure and prints warning messages.
 /// </summary>
 /// <returns>Returns true in case of no error, otherwise false.</returns>
 internal static bool WarnIfFailed(this Interop.ErrorCode err, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0)
 {
     if (err.IsFailed())
     {
         Log.Debug(LogTag, $"{msg}, err: {err.ToString()}", file, func, line);
         return(false);
     }
     return(true);
 }