private static void ThrowArgumentNullException(DomainLogger logger, string tag, string message) { var ex = new ArgumentNullException(message); logger.E(tag, ex.ToString() ?? ""); throw ex; }
public static unsafe void *MustNotBeNullPointer([NotNull] DomainLogger logger, [NotNull] string tag, [NotNull] string argumentName, void *argumentValue) { Debug.Assert(argumentValue != null); if (argumentValue == null) { var ex = new ArgumentNullException(argumentName); logger.E(tag, ex.ToString() ?? ""); throw ex; } return(argumentValue); }
public static T MustNotBeNull <T>([NotNull] DomainLogger logger, [NotNull] string tag, [NotNull] string argumentName, T argumentValue) where T : class { Debug.Assert(argumentValue != null); if (argumentValue == null) { var ex = new ArgumentNullException(argumentName); logger.E(tag, ex.ToString() ?? ""); throw ex; } return(argumentValue); }
public static void LogAndThrow([NotNull] DomainLogger logger, [NotNull] Exception e, [NotNull] string tag, [NotNull] string message, bool fatal) { if (fatal) { logger.E(tag, message, e); } else { logger.W(tag, message, e); } throw e; }