Repository navigation
Expand file tree
/
Copy pathIErrorHandler.cs
More file actions
43 lines (42 loc) · 2.53 KB
/
Copy pathIErrorHandler.cs
File metadata and controls
43 lines (42 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Management.Automation;
namespace NuGet.PowerShell.Commands
{
/// <summary>
/// Interface defining common NuGet Cmdlet error handling and generation operations.
/// </summary>
public interface IErrorHandler
{
/// <summary>
/// Handles a native PowerShell ErrorRecord. If terminating is set to true, this method does not return.
/// </summary>
/// <param name="errorRecord">The record representing the error condition.</param>
/// <param name="terminating">If true, write a terminating error else write to error stream.</param>
void HandleError(ErrorRecord errorRecord, bool terminating);
/// <summary>
/// Handles a regular BCL Exception. If terminating is set to true, this method does not return.
/// </summary>
/// <param name="exception">The exception representing the error condition.</param>
/// <param name="terminating">If true, write a terminating error else write to error stream.</param>
/// <param name="errorId">The local-agnostic error id to use. Well-known error ids are defined in <see cref="NuGet.PowerShell.Commands.NuGetErrorId"/>.</param>
/// <param name="category">The PowerShell ErrorCategory to use.</param>
/// <param name="target">The context object associated with this error condition. This may be null.</param>
void HandleException(Exception exception, bool terminating, string errorId = NuGetErrorId.CmdletUnhandledException, ErrorCategory category = ErrorCategory.NotSpecified, object target = null);
/// <summary>
/// Generates an error to signify the specified project was not found.
/// If terminating is set to true, this method does not return.
/// </summary>
/// <param name="projectName">The name of the project that was not found.</param>
/// <param name="terminating">If true, write a terminating error else write to error stream.</param>
void WriteProjectNotFoundError(string projectName, bool terminating);
/// <summary>
/// Generates a terminating error to signify there is no open solution. This method does not return.
/// </summary>
void ThrowSolutionNotOpenTerminatingError();
/// <summary>
/// Generates a terminating error to signify there is are no compatible projects or the solution is empty.
/// This method does not return.
/// </summary>
void ThrowNoCompatibleProjectsTerminatingError();
}
}