public IRestEndpoint AggregateNext(string fullResourcePath) { if (string.IsNullOrEmpty(fullResourcePath)) { return(_startEndpoint); } IRestEndpoint endpoint = _startEndpoint; string[] dirs = fullResourcePath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); foreach (string dir in dirs) { var path = new AggregatorNextPath(dir, _namingConventionSwitcher); try { endpoint = endpoint.Next(path); } catch (Exception ex) { throw new NextEndpointErrorException(path, ex); } if (endpoint == null) { throw new NextEndpointNotFoundException(path); } } return(endpoint); }
public NextEndpointErrorException(AggregatorNextPath dir, Exception innerException) : base("Error loading the '" + dir.Raw + "' endpoint: " + innerException.Message, innerException) { }
public NextEndpointNotFoundException(AggregatorNextPath dir) : base(ErrorStatus.NotFound, "The '" + dir.Raw + "' endpoint was not found.") { }