Skip to content

Commit

Permalink
Rescue ArgumentError when executing on remote node
Browse files Browse the repository at this point in the history
  • Loading branch information
martosaur committed Mar 22, 2023
1 parent f337ac6 commit 4bc75ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/nebulex_local_multilevel_adapter.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
defmodule NebulexLocalMultilevelAdapter do
require Logger

alias Nebulex.Cache.Cluster
@external_resource readme = Path.join([__DIR__, "../README.md"])

Expand Down Expand Up @@ -183,7 +185,11 @@ defmodule NebulexLocalMultilevelAdapter do
def execute_from_remote(cache, cache_name, fun, args) do
apply(cache, :with_dynamic_cache, [cache_name, cache, fun, args])
rescue
Nebulex.RegistryLookupError ->
e in [ArgumentError, Nebulex.RegistryLookupError] ->
:error
|> Exception.format(e, __STACKTRACE__)
|> Logger.warning(crash_reason: {e, __STACKTRACE__})

:ok

e ->
Expand Down

0 comments on commit 4bc75ee

Please sign in to comment.