Error() public method

public Error ( ErrorCategory category, string targetObjectValue, string messageText ) : bool
category ErrorCategory
targetObjectValue string
messageText string
return bool
        public void AddPackageSource(string name, string location, bool trusted, Request request)
        {
            if (string.IsNullOrEmpty(location))
            {
                request.Error(ErrorCategory.InvalidArgument, "location", "Location missing");
                return;
            }

            Do(request, x => x.AddPackageSource(new FeedUri(location)));
        }
 /// <summary>
 /// Creates a <see cref="IOneGetContext"/> instance and executes a delegate on it, handling common exception types.
 /// </summary>
 private void Do(Request request, Action<IOneGetContext> action)
 {
     try
     {
         using (var context = BuildContext(request))
             action(context);
     }
         #region Error handling
     catch (OperationCanceledException)
     {}
     catch (FormatException ex)
     {
         request.Error(ErrorCategory.InvalidArgument, "", ex.Message);
     }
     catch (WebException ex)
     {
         request.Error(ErrorCategory.ConnectionError, "", ex.Message);
     }
     catch (NotSupportedException ex)
     {
         request.Error(ErrorCategory.NotImplemented, "", ex.Message);
     }
     catch (IOException ex)
     {
         request.Error(ErrorCategory.OpenError, "", ex.Message);
     }
     catch (UnauthorizedAccessException ex)
     {
         request.Error(ErrorCategory.PermissionDenied, "", ex.Message);
     }
     catch (InvalidDataException ex)
     {
         request.Error(ErrorCategory.InvalidData, "", ex.Message);
     }
     catch (SignatureException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     catch (DigestMismatchException ex)
     {
         Log.Info(ex.LongMessage);
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     catch (SolverException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     catch (ExecutorException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     catch (InvalidOperationException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     #endregion
 }
 public void DownloadPackage(string fastPackageReference, string location, Request request)
 {
     request.Debug("Calling '{0}::DownloadPackage'", PackageProviderName);
     if (string.IsNullOrEmpty(location))
     {
         request.Error(ErrorCategory.InvalidArgument, "location", "Location parameter missing");
         return;
     }
     Do(request, x => x.DownloadPackage(fastPackageReference, location));
 }
 public void FindPackageByUri(Uri uri, int id, Request request)
 {
     request.Debug("Calling '{0}::FindPackageByUri'", PackageProviderName);
     if (uri == null)
     {
         request.Error(ErrorCategory.InvalidArgument, "uri", "Uri parameter missing");
         return;
     }
     Do(request, x => x.FindPackageBy(uri.OriginalString));
 }
 public void FindPackageByFile(string file, int id, Request request)
 {
     request.Debug("Calling '{0}::FindPackageByFile'", PackageProviderName);
     if (string.IsNullOrEmpty(file))
     {
         request.Error(ErrorCategory.InvalidArgument, "file", "File parameter missing");
         return;
     }
     Do(request, x => x.FindPackageBy(file));
 }
        public void RemovePackageSource(string name, Request request)
        {
            request.Debug("Calling '{0}::RemovePackageSource'", PackageProviderName);
            if (string.IsNullOrEmpty(name))
            {
                request.Error(ErrorCategory.InvalidArgument, "name", "Name parameter missing");
                return;
            }

            Do(request, x => x.RemovePackageSource(name));
        }
 public void AddPackageSource(string name, string location, bool trusted, Request request)
 {
     request.Debug("Calling '{0}::AddPackageSource'", PackageProviderName);
     if (string.IsNullOrEmpty(location))
     {
         request.Error(ErrorCategory.InvalidArgument, "location", "Location parameter missing");
         return;
     }
     Do(request, x => x.AddPackageSource(location));
 }
        public void FindPackage(string name, string requiredVersion, string minimumVersion, string maximumVersion, int id, Request request)
        {
            if (string.IsNullOrEmpty(name))
            {
                request.Error(ErrorCategory.InvalidArgument, "name", "Name missing");
                return;
            }

            Do(request, x => x.FindPackage(name,
                string.IsNullOrEmpty(requiredVersion) ? null : new ImplementationVersion(requiredVersion),
                string.IsNullOrEmpty(minimumVersion) ? null : new ImplementationVersion(minimumVersion),
                string.IsNullOrEmpty(maximumVersion) ? null : new ImplementationVersion(maximumVersion)));
        }
 /// <summary>
 /// Creates a <see cref="OneGetCommand"/> instance and executes a delegate on it, handling common exception types.
 /// </summary>
 private void Do(Request request, Action<OneGetCommand> action, [CallerMemberName] string caller = null)
 {
     request.Debug("Calling '{0}::{1}'", PackageProviderName, caller);
     try
     {
         using (var command = BuildCommand(request))
             action(command);
     }
         #region Error handling
     catch (OperationCanceledException)
     {}
     catch (FormatException ex)
     {
         request.Error(ErrorCategory.InvalidArgument, "", ex.Message);
     }
     catch (WebException ex)
     {
         request.Error(ErrorCategory.ConnectionError, "", ex.Message);
     }
     catch (NotSupportedException ex)
     {
         request.Error(ErrorCategory.NotImplemented, "", ex.Message);
     }
     catch (IOException ex)
     {
         request.Error(ErrorCategory.OpenError, "", ex.Message);
     }
     catch (UnauthorizedAccessException ex)
     {
         request.Error(ErrorCategory.PermissionDenied, "", ex.Message);
     }
     catch (InvalidDataException ex)
     {
         request.Error(ErrorCategory.InvalidData, "", ex.Message);
     }
     catch (SignatureException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     catch (DigestMismatchException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     catch (SolverException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     catch (ExecutorException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     catch (ConflictException ex)
     {
         request.Error(ErrorCategory.MetadataError, "", ex.Message);
     }
     #endregion
 }
        public void RemovePackageSource(string name, Request request)
        {
            if (string.IsNullOrEmpty(name))
            {
                request.Error(ErrorCategory.InvalidArgument, "name", "Name missing");
                return;
            }

            Do(request, x => x.RemovePackageSource(new FeedUri(name)));
        }
        public void FindPackageByUri(Uri uri, int id, Request request)
        {
            if (uri == null)
            {
                request.Error(ErrorCategory.InvalidArgument, "uri", "Uri missing");
                return;
            }

            Do(request, x => x.FindPackageBy(uri.OriginalString));
        }
        public void FindPackageByFile(string file, int id, Request request)
        {
            if (string.IsNullOrEmpty(file))
            {
                request.Error(ErrorCategory.InvalidArgument, "file", "File missing");
                return;
            }

            Do(request, x => x.FindPackageBy(file));
        }