View Source Tux.Alertable protocol (Tux v0.4.0)
Alertable protocol is used by Tux.Show to display command error results
in a user-friendly fashion using the Tux.Alert struct.
The protocol is implemented for the following types:
Strings – alertable is implemented for strings, so that if you return
{:error, "some message"}from a command, the message will be shown as aTux.Alert.Tux.Error - alertable is also implemented for the
Tux.Errorstruct or any struct which is constructed withuse Tux.Error, so that if you return{:error, %Tux.Error{}}or{:error, %MyDerivedError{}}from a command, the struct will be shown as aTux.Alert.Exceptions - alertable is implemented for the Elixir
Exceptionstructs and will extract the:messagefield as the alert's title. Thus, if your app throws an exception and the dispatcher is using the optionsrescue: true, the thrown exception will be shown as an alert.
Summary
Types
@type t() :: term()
All the types that implement this protocol.