Module watts_plugin_error

a dedicated module to creating the error messages and mails for plugins.

Description

a dedicated module to creating the error messages and mails for plugins

Data Types

error_type()

error_type() = bad_result | bad_error | bad_parameter | error_parameter | plugin_error | missing_result | unknown

Function Index

create_body/4*create the email body and provide as much information as possible.
create_mail/4*create email subject and body for the error.
error_type_to_description/1*convert the type to reasonable helpful description of the error.
error_type_to_subject/1*convert the error type to the email subject.
log_message/3*create the log result of the plugin.
log_output/1*create a loggable string from the output map.
maybe_send_mail/3*send out the error mail.
maybe_send_mail_return_error/4create the error and if configured send out the mail.
maybe_sha256sum/1*create the sha256sum from given data.
receipient_list/3*just create the list of receipients, may include undefined.
receipients/3*create the list of receipients ensure they are strings.
response_or_error/2*create a nice line regarding either the parsing result or error reason.
sha256sum/1*create the sha256sum of the file, if possible.
to_error_type/2*convert the error condition to a single atom.
user_message/2*create the user message for the error, state if email has been sent.

Function Details

create_body/4 *

create_body(ErrorType, MapOrReason, Output, Info) -> string()

create the email body and provide as much information as possible

create_mail/4 *

create_mail(ErrorType, MapOrReason, Output, Info) -> #{subject => string(), body => string()}

create email subject and body for the error

error_type_to_description/1 *

error_type_to_description(ErrorType::error_type()) -> string()

convert the type to reasonable helpful description of the error

error_type_to_subject/1 *

error_type_to_subject(X1::error_type()) -> string()

convert the error type to the email subject

log_message/3 *

log_message(ErrorType, MapOrReason, Output) -> string()

create the log result of the plugin

To do

log_output/1 *

log_output(X1::watts_plugin_runner:output()) -> string()

create a loggable string from the output map

maybe_send_mail/3 *

maybe_send_mail(X1::boolean(), X2::map(), Info::map()) -> atom()

send out the error mail

maybe_send_mail_return_error/4

maybe_send_mail_return_error(Result, MapOrReason, Output, Info) -> {error, #{user_msg => string(), log_msg => string()}}

create the error and if configured send out the mail

maybe_sha256sum/1 *

maybe_sha256sum(X1::{ok, binary()} | any()) -> list()

create the sha256sum from given data

receipient_list/3 *

receipient_list(X1::atom(), Mail::string() | undefined, AMail::string() | undefined) -> [string() | undefined]

just create the list of receipients, may include undefined

receipients/3 *

receipients(To::atom(), DMail::string() | undefined, AMail::string() | undefined) -> [string()]

create the list of receipients ensure they are strings

response_or_error/2 *

response_or_error(X1::error_type(), Reason::atom() | map()) -> string()

create a nice line regarding either the parsing result or error reason

sha256sum/1 *

sha256sum(Cmd::binary()) -> list()

create the sha256sum of the file, if possible

to_error_type/2 *

to_error_type(Result, Info) -> error_type()

convert the error condition to a single atom

user_message/2 *

user_message(ErrorType::error_type(), X2::boolean()) -> string()

create the user message for the error, state if email has been sent


Generated by EDoc