Whenever an operation returns an error in Mnesia, a description
of the error is available. For example, the functions
mnesia:transaction(Fun), or mnesia:create_table(N,L)
may return the tuple {aborted, Reason}, where Reason
is a term describing the error. The following function is used to
retrieve more detailed information about the error:
Errors in Mnesia
The following is a list of valid errors in Mnesia.
- badarg. Bad or invalid argument, possibly bad type.
- no_transaction. Operation not allowed outside transactions.
- combine_error. Table options were illegally combined.
- bad_index. Index already exists, or was out of bounds.
- already_exists. Schema option to be activated is already on.
- index_exists. Some operations cannot be performed on tables with an index.
- no_exists.; Tried to perform operation on non-existing (non-alive) item.
- system_limit.; A system limit was exhausted.
- mnesia_down. A transaction involves records on a
remote node which became unavailable before the transaction
was completed. Record(s) are no longer available elsewhere in
the network.
- not_a_db_node. A node was mentioned which does not exist in the schema.
- bad_type.; Bad type specified in argument.
- node_not_running. Node is not running.
- truncated_binary_file. Truncated binary in file.
- active. Some delete operations require that all active records are removed.
- illegal. Operation not supported on this record.
The following example illustrates a function which returns an error, and the method to retrieve more detailed error information.
The function mnesia:create_table(bar, [{attributes, 3.14}]) will return the tuple {aborted,Reason}, where Reason is the tuple
{bad_type,bar,3.14000}.
The function mnesia:error_description(Reason), returns the term
{"Bad type on some provided arguments",bar,3.14000} which is an error
description suitable
for display.