Skip to content

fix: improve LSInvalidFile printing #1280

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/exception_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@

struct LSInvalidFile <: Exception
msg::AbstractString
uri::URI
end

function Base.showerror(io::IO, ex::LSInvalidFile)
print(io, ex.msg)
print(io, ex.msg, " File: '", uri2filepath(ex.uri), "'")

Check warning on line 71 in src/exception_types.jl

View check run for this annotation

Codecov / codecov/patch

src/exception_types.jl#L71

Added line #L71 was not covered by tests
end
2 changes: 1 addition & 1 deletion src/textdocument.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct TextDocument

function TextDocument(uri::URI, text::AbstractString, version::Int, lid = nothing)
# TODO Remove this check eventually
occursin('\0', text) && throw(LSInvalidFile("Tried to set a text with an embedded NULL as the document content."))
occursin('\0', text) && throw(LSInvalidFile("Tried to set a text with an embedded NULL as the document content.", uri))

line_offsets = _compute_line_offsets(text)
line_indices = _compute_line_indices(text)
Expand Down
Loading