Exemplo n.º 1
0
 protected WcfRoutine(Guid correlationToken, Routines.MemberTag memberTag, string faultCodeNamespace,
                      object input)
     : this(
         correlationToken, memberTag, faultCodeNamespace,
         ApplicationSettings,
         InjectedManager.ResetConfigurationContainerFactoryClassic(),
         input)
 {
 }
Exemplo n.º 2
0
        public static Exception TransformException(
            Exception exception,
            Guid correlationToken,
            Routines.MemberTag memberTag,
            string faultCodeNamespace /*, Func<Exception, string> markdownException*/)
        {
            var    code = default(string);
            string message;

            if (exception is AdminkaException adminkaException)
            {
                message = adminkaException.Message;
                code    = adminkaException.Code;
            }
            else
            {
                message = "Remote server error: " + exception.Message + "(" + exception.GetType().FullName + ")";
                if (exception.Data.Contains("Code"))
                {
                    code = exception.Data["Code"] as string;
                }
            }

            var routineError = new RoutineError()
            {
                CorrelationToken = correlationToken,
                MemberTag        = new MemberTag()
                {
                    Namespace = memberTag.Namespace,
                    Type      = memberTag.Type,
                    Member    = memberTag.Member
                },
                Message = message,
                AdminkaExceptionCode = code,

                Details = InjectedManager.Markdown(exception)
            };

            if (exception.Data.Count > 0)
            {
                var data = new Dictionary <string, string>();
                foreach (var k in exception.Data.Keys)
                {
                    if (k is string kStr && exception.Data[k] is string vStr)
                    {
                        data[kStr] = vStr;
                    }
                }
                if (data.Count > 0)
                {
                    routineError.Data = data;
                }
            }
            return(new WcfException(routineError, message, "UNSPECIFIED", faultCodeNamespace));
        }
Exemplo n.º 3
0
 protected WcfRoutine(
     Guid correlationToken,
     Routines.MemberTag memberTag,
     string faultCodeNamespace,
     ApplicationSettings applicationSettings,
     IConfigurationContainerFactory configurationContainerFactory,
     object input)
     : base(
         applicationSettings: applicationSettings,
         performanceCounters: ApplicationSettings.PerformanceCounters,
         configurationContainerFactory: configurationContainerFactory,
         transformException: (ex, g, mt /*, md*/) => TransformException(ex, g, mt, faultCodeNamespace /*, md*/),
         correlationToken: correlationToken,
         documentBuilder: null,
         memberTag: memberTag,
         anonymousUserContext: new AnonymousUserContext(),
         input: input)
 {
 }
Exemplo n.º 4
0
 public WcfRoutine(Routines.MemberTag memberTag, string faultCodeNamespace, object input)
     : this(Guid.NewGuid(), memberTag, faultCodeNamespace,
            input)
 {
 }