Nebulex.KeyError exception (Nebulex v3.1.0)

Copy Markdown View Source

Raised, or returned in an {:error, _} tuple, when a key does not exist in the cache.

The cache ran the command, but the requested key was missing or expired.

Exception fields

See t/0.

Error reasons

The :reason field can be one of:

  • :not_found - the key doesn't exist in the cache.

  • :expired - the key doesn't exist in the cache because it expired.

Summary

Types

t()

The type for this exception struct.

Types

t()

@type t() :: %Nebulex.KeyError{
  __exception__: term(),
  key: any(),
  metadata: keyword(),
  reason: atom()
}

The type for this exception struct.

This exception has the following public fields:

  • :reason - the error reason. The two possible reasons are :not_found or :expired. Defaults to :not_found.

  • :key - the requested key.

  • :metadata - the options given to the exception, minus :reason and :key. For example, raise Nebulex.KeyError, key: :test, foo: :bar gives the metadata [foo: :bar].