Exemple #1
0
        private static void ThrowArgumentNullException(DomainLogger logger, string tag, string message)
        {
            var ex = new ArgumentNullException(message);

            logger.E(tag, ex.ToString() ?? "");
            throw ex;
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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;
        }