/// <inheritdoc />
        public void RaiseException(string errorCode, Exception ex, params object[] args)
        {
            IErrorDetail expDetail = _exceptionDataProvider.GetExceptionDetail(errorCode);

            if (!(expDetail.Clone() is IErrorDetail errorDetail))
            {
                return;
            }

            _errorDetailLocalizer.LocalizeErrorDetail(errorDetail, args);
            if (ex != null)
            {
                _exceptionLogger.LogException(errorDetail, ex);
            }
            RaisedException exception     = new RaisedException(errorDetail.Message, ex);
            ExceptionData   exceptionData = HandleException(errorDetail);

            if (exceptionData != null)
            {
                foreach (string key in exceptionData.Keys)
                {
                    exception.Data[key] = exceptionData[key];
                }
            }
            throw exception;
        }
        /// <inheritdoc />
        public IActionResult ManageException(string errorCode, Exception ex, params object[] args)
        {
            IErrorDetail errorDetail;

            if (ex is RaisedException)
            {
                errorDetail =
                    _exceptionDataProvider.GetExceptionDetail(ex.Data["ExceptionCode"].ToString())
                    .Clone() as IErrorDetail;
                errorDetail.Message = ex.Data["Message"].ToString();
            }
            else
            {
                errorDetail = _exceptionDataProvider.GetExceptionDetail(errorCode).Clone() as IErrorDetail;
                _errorDetailLocalizer.LocalizeErrorDetail(errorDetail, args);
                _exceptionLogger.LogException(errorDetail, ex);
            }
            ExceptionData exceptionData = HandleException(errorDetail, ex);

            return(_actionResultCreator.CreateActionResult(errorDetail, exceptionData));
        }