Nebulex.KeyError exception (Nebulex v3.0.0-rc.1)

View Source

Raised at runtime when a key does not exist in the cache.

This exception denotes the cache executed a command, but there was an issue with the requested key; for example, it doesn't exist.

Exception fields

See t/0.

Error reasons

The :reason field can assume a few Nebulex-specific values:

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

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

Summary

Types

t()

The type for this exception struct.

Types

t()

@type t() :: %Nebulex.KeyError{
  __exception__: true,
  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 metadata contains the options given to the exception excluding the :reason and :key that are part of the exception fields. For example, when raising an exception raise Nebulex.KeyError, key: :test, foo: :bar, the metadata will be [foo: :bar].