private void NotFoundExceptionHandler(IInvocation invocation, NotFoundException exception)
        {
            var methodName = invocation.Method.Name;
            var message    = $"Not found error in method {methodName}. {exception.Message}";

            this._loggerService.LogMessage(message, LogLevel.Error);

            this._loggerService.LogMessage(
                new LogMessage
            {
                ClassName  = this.ToString(),
                Message    = exception.Message,
                MethodName = invocation.Method.Name
            },
                LogLevel.Debug);

            throw new System.ServiceModel.FaultException <ExceptionDetail>(
                      new ExceptionDetail(
                          false,
                          message,
                          methodName,
                          status: ErrorCode.NotFoundInCache,
                          exceptionType: exception.GetType()),
                      message
                      );
        }
Beispiel #2
0
        public void GetContextTest()
        {
            var result = new NotFoundException();

            Assert.AreEqual(result.GetType().Name, "NotFoundException");

            var result2 = new NotFoundException("mensaje");

            Assert.AreEqual(result2.GetType().Name, "NotFoundException");

            var result3 = new NotFoundException("mensaje", new Exception());

            Assert.AreEqual(result3.GetType().Name, "NotFoundException");
        }