Skip to content

Commit

Permalink
Fix docfx warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ygg01 committed Jun 4, 2024
1 parent 2139cd4 commit c6aa001
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions Linguini.Bundle/Errors/FluentError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Linguini.Bundle.Errors
{
/// <summary>
/// Base record for Linguini Fluent errors.
/// </summary>
public abstract record FluentError
{
/// <summary>
Expand All @@ -20,6 +23,12 @@ public abstract record FluentError
{
return null;
}

/// <summary>
/// String represntation of the error.
/// </summary>
/// <returns></returns>
public override string ToString() => $"Error (${ErrorKind()})";
}

/// <summary>
Expand Down Expand Up @@ -109,23 +118,20 @@ public static ResolverFluentError TooManyPlaceables()

public static ResolverFluentError Reference(IInlineExpression self)
{
switch (self)
return self switch
{
case FunctionReference funcRef:
return new($"Unknown function: {funcRef.Id}()", ErrorType.Reference);
case MessageReference msgRef when msgRef.Attribute == null:
return new($"Unknown message: {msgRef.Id}", ErrorType.Reference);
case MessageReference msgRef:
return new($"Unknown attribute: {msgRef.Id}.{msgRef.Attribute}", ErrorType.Reference);
case TermReference termReference when termReference.Attribute == null:
return new($"Unknown term: -{termReference.Id}", ErrorType.Reference);
case TermReference termReference:
return new($"Unknown attribute: -{termReference.Id}.{termReference.Attribute}", ErrorType.Reference);
case VariableReference varRef:
return new($"Unknown variable: ${varRef.Id}", ErrorType.Reference);
default:
throw new ArgumentException($"Expected reference got ${self.GetType()}");
}
FunctionReference funcRef => new($"Unknown function: {funcRef.Id}()", ErrorType.Reference),
MessageReference msgRef when msgRef.Attribute == null => new($"Unknown message: {msgRef.Id}",
ErrorType.Reference),
MessageReference msgRef => new($"Unknown attribute: {msgRef.Id}.{msgRef.Attribute}",
ErrorType.Reference),
TermReference termReference when termReference.Attribute == null => new(
$"Unknown term: -{termReference.Id}", ErrorType.Reference),
TermReference termReference => new($"Unknown attribute: -{termReference.Id}.{termReference.Attribute}",
ErrorType.Reference),
VariableReference varRef => new($"Unknown variable: ${varRef.Id}", ErrorType.Reference),
_ => throw new ArgumentException($"Expected reference got ${self.GetType()}")
};
}

public static ResolverFluentError Cyclic(Pattern pattern)
Expand Down

0 comments on commit c6aa001

Please sign in to comment.