Esempio n. 1
0
        public static Exception GetAuthorizationRequiredException(MessageFault fault)
        {
            AuthorizationRequiredFault failure = fault.DeserializeMessageWithPayload <AuthorizationRequiredFault>();

            if (failure == null)
            {
                return(new FaultException(fault));
            }

            return(new AuthorizationRequiredException(failure));
        }
Esempio n. 2
0
        public static Exception GetInvalidRepresentationException(MessageFault fault)
        {
            RepresentationFailures failure = fault.DeserializeMessageWithPayload <RepresentationFailures>();

            if (failure == null)
            {
                return(new FaultException(fault));
            }

            return(InvalidRepresentationException.GetException(failure));
        }
Esempio n. 3
0
        public static Exception GetUnwillingToPerformException(MessageFault fault)
        {
            DispatchRequestFailures failure = fault.DeserializeMessageWithPayload <DispatchRequestFailures>();

            if (failure?.AdministratorDetails == null)
            {
                return(new FaultException(fault));
            }

            throw new UnwillingToPerformException(failure);
        }
Esempio n. 4
0
        public static Exception GetPermissionDeniedException(MessageFault fault)
        {
            RequestFailures failure = fault.DeserializeMessageWithPayload <RequestFailures>();

            if (failure == null)
            {
                return(new FaultException(fault));
            }

            if (failure.RequestAdministratorDetails?.RequestFailureSource == RequestFailureSource.ResourceIsMissing)
            {
                return(new ResourceNotFoundException());
            }

            return(new PermissionDeniedException(failure));
        }