@@ -29,6 +29,11 @@ public class ModDependencyResolveResult
2929 /// </summary>
3030 public HashSet < string > NotFoundDependencies { get ; } = new HashSet < string > ( ) ;
3131
32+ /// <summary>
33+ /// List of errors that occurred during dependency resolution.
34+ /// </summary>
35+ public List < DependencyResolveError > Errors { get ; } = new List < DependencyResolveError > ( ) ;
36+
3237 /// <summary>
3338 /// Combines the results of multiple resolve operations.
3439 /// </summary>
@@ -59,6 +64,9 @@ public static ModDependencyResolveResult Combine(IEnumerable<ModDependencyResolv
5964
6065 foreach ( var notFound in result . NotFoundDependencies )
6166 returnValue . NotFoundDependencies . Add ( notFound ) ;
67+
68+ foreach ( var error in result . Errors )
69+ returnValue . Errors . Add ( error ) ;
6270 }
6371
6472 // Remove dependencies that were found from the notFound set.
@@ -68,4 +76,53 @@ public static ModDependencyResolveResult Combine(IEnumerable<ModDependencyResolv
6876 returnValue . FoundDependencies . AddRange ( idToNewestVersion . Values ) ;
6977 return returnValue ;
7078 }
79+
80+ /// <summary>
81+ /// Creates a result with an error for a specific package.
82+ /// </summary>
83+ /// <param name="packageId">The package ID that failed to resolve.</param>
84+ /// <param name="exception">The exception that occurred during resolution.</param>
85+ /// <param name="resolver">The resolver that caused the error.</param>
86+ /// <returns>A result containing the error information.</returns>
87+ public static ModDependencyResolveResult FromError ( string packageId , Exception exception , string resolver )
88+ {
89+ var result = new ModDependencyResolveResult ( ) ;
90+ result . Errors . Add ( new DependencyResolveError ( packageId , exception , resolver ) ) ;
91+ result . NotFoundDependencies . Add ( packageId ) ;
92+ return result ;
93+ }
94+ }
95+
96+ /// <summary>
97+ /// Represents an error that occurred during dependency resolution.
98+ /// </summary>
99+ public class DependencyResolveError
100+ {
101+ /// <summary>
102+ /// The package ID that failed to resolve.
103+ /// </summary>
104+ public string PackageId { get ; }
105+
106+ /// <summary>
107+ /// The exception that occurred during resolution.
108+ /// </summary>
109+ public Exception Exception { get ; }
110+
111+ /// <summary>
112+ /// The name of the resolver that caused the error.
113+ /// </summary>
114+ public string Resolver { get ; }
115+
116+ /// <summary>
117+ /// Creates a new dependency resolve error.
118+ /// </summary>
119+ /// <param name="packageId">The package ID that failed to resolve.</param>
120+ /// <param name="exception">The exception that occurred during resolution.</param>
121+ /// <param name="resolver">The name of the resolver that caused the error.</param>
122+ public DependencyResolveError ( string packageId , Exception exception , string resolver )
123+ {
124+ PackageId = packageId ;
125+ Exception = exception ;
126+ Resolver = resolver ;
127+ }
71128}
0 commit comments