Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slice source text in SyntaxException #5493

Merged
merged 7 commits into from
Dec 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/HotChocolate/Language/src/Language.Utf8/SyntaxException.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
using System;
using System.Text;

namespace HotChocolate.Language;

[Serializable]
public class SyntaxException
: Exception
public sealed class SyntaxException : Exception
{
internal SyntaxException(Utf8GraphQLReader reader, string message)
: base(message)
internal SyntaxException(Utf8GraphQLReader reader, string message) : base(message)
{
Position = reader.Position;
Line = reader.Line;
Column = reader.Column;
SourceText = Encoding.UTF8.GetString(reader.GraphQLData.ToArray());
}

internal SyntaxException(Utf8GraphQLReader reader, string message, params object[] args)
Expand All @@ -26,6 +22,4 @@ internal SyntaxException(Utf8GraphQLReader reader, string message, params object
public int Line { get; }

public int Column { get; }

public string SourceText { get; }
}