Skip to content

Commit

Permalink
fix: gracefully handle injected attributes (#235)
Browse files Browse the repository at this point in the history
Fixes #234
  • Loading branch information
mhanberg authored Sep 21, 2023
1 parent 1c860de commit 5ff9830
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/next_ls/runtime/sidecar.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ defmodule NextLS.Runtime.Sidecar do
end

def handle_info({{:tracer, :reference, :attribute}, payload}, state) do
name = Attributes.get_attribute_reference_name(payload.file, payload.meta[:line], payload.meta[:column])
if name, do: DB.insert_reference(state.db, %{payload | identifier: name})
try do
name = Attributes.get_attribute_reference_name(payload.file, payload.meta[:line], payload.meta[:column])
if name, do: DB.insert_reference(state.db, %{payload | identifier: name})
rescue
_ -> :ok
end

{:noreply, state}
end
Expand Down

0 comments on commit 5ff9830

Please sign in to comment.