public static Error ToError(this ContractError error, params object[] args) { var number = (uint)ErrorOffset.Contract + (uint)error; var name = ERROR_NAME_PREFIX + error.ToString().ToUpper(); return(Error.Factory.FromResource(number, name, ResourceContractErrors.ResourceManager, args)); }
protected override string NotFoundErrorMessage(string entityName, ContractError error, MappingRequest request) { switch (error.Reason) { case ErrorReason.SourceSystem: return(string.Format("Source System '{0}' does not exist", request.SystemName)); default: return(string.Format("Mapping String '{0}' not found for Source System '{1}'", request.Identifier, request.SystemName)); } }
protected virtual string Reason(ContractError error) { switch (error.Type) { case ErrorType.NotFound: return("Unknown {0}"); case ErrorType.VersionConflict: return("Version Conflict"); default: return("Unknown {0}"); } }
protected string ErrorMessage(string entityName, ContractError error, T request) { switch (error.Type) { case ErrorType.Ambiguous: return(this.NotFoundErrorMessage(entityName, error, request)); case ErrorType.NotFound: return(this.NotFoundErrorMessage(entityName, error, request)); case ErrorType.VersionConflict: return("Version Conflict"); default: return("Unknown"); } }
public Fault Create(string entityName, ContractError error, T request) { var fault = new Fault { Reason = string.Format(Reason(error), entityName), }; this.PopulateFault(fault, request); var message = this.ErrorMessage(entityName, error, request); if (request.ValidAtExists) { message += string.Format(" at the given date '{0}'", request.ValidAt); fault.AsOfDate = request.ValidAt; } fault.Message = message; return(fault); }
protected override string NotFoundErrorMessage(string entityName, ContractError error, CrossMappingRequest request) { return(string.Format("Ambiguous Mappings were found for Mapping String '{1}' for Source System '{0}' and Destination System '{2}'", request.SystemName, request.Identifier, request.TargetSystemName)); }
protected override string Reason(ContractError error) { return("Ambiguous Mapping Found"); }
protected override string NotFoundErrorMessage(string entityName, ContractError error, CrossMappingRequest request) { return(string.Format("Mapping String '{1}' not found for Source System '{0}'", request.SystemName, request.Identifier, request.TargetSystemName)); }
protected override string Reason(ContractError error) { return("Unknown Mapping"); }
protected override string NotFoundErrorMessage(string entityName, ContractError error, GetRequest request) { return(string.Format("{0} identified by '{1}' not found", entityName, request.EntityId)); }
protected abstract string NotFoundErrorMessage(string entityName, ContractError error, T request);