MishkaInstaller.Helper.MnesiaAssistant.Error (Mishka installer v0.1.7)

Copy Markdown View Source

Turns raw Mnesia results into a normalised {:ok, :atomic} / {:error, error, description} shape and logs them.

Mnesia transactions and schema operations return {:atomic, value} or {:aborted, reason}, and reason is often an atom from the documented error list. error_description/2 maps those to a human-readable description and the appropriate log level.

Summary

Functions

Returns a descriptive term for a Mnesia error. Delegates to :mnesia.error_description/1.

Normalises and logs a Mnesia result for the given identifier.

Functions

error_description(error)

@spec error_description(term()) :: term()

Returns a descriptive term for a Mnesia error. Delegates to :mnesia.error_description/1.

error_description(error, identifier)

@spec error_description(term(), term()) :: {:ok, :atomic} | {:error, term(), term()}

Normalises and logs a Mnesia result for the given identifier.

Returns {:ok, :atomic} on success, or {:error, error, description} otherwise. Successful and "already exists" outcomes are logged at a low level; genuine failures are logged as errors.