Skip to content

Commit

Permalink
Format evaluation errors in a more legible way
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocampama committed Apr 9, 2021
1 parent 82bd03a commit e847906
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Sources/LLBBuildSystem/Functions/Evaluation/RuleEvaluation.swift
Expand Up @@ -55,6 +55,25 @@ public enum LLBRuleEvaluationError: Error {
case ruleEvaluationError(LLBLabel, Error)
}

extension LLBRuleEvaluationError: CustomStringConvertible {
public var description: String {
switch self {
case .artifactAlreadyInitialized:
return "artifactAlreadyInitialized"
case .noRuleLookupDelegate:
return "noRuleLookupDelegate"
case .ruleEvaluationError(let label, let error):
return "ruleEvaluationError(\(label.canonical), \(error))"
case .ruleEvaluationKeyDeserializationError:
return "ruleEvaluationKeyDeserializationError"
case .ruleNotFound:
return "ruleNotFound"
case .unassignedOutput(let artifact):
return "unassignedOutput(\(artifact.path)"
}
}
}

public final class RuleEvaluationFunction: LLBBuildFunction<LLBRuleEvaluationKeyID, LLBRuleEvaluationValue> {
let ruleLookupDelegate: LLBRuleLookupDelegate?

Expand Down

0 comments on commit e847906

Please sign in to comment.