microscope v1.0.1 Microscope.Validation

Provides functions for validating arguments or options to Microscope.

Link to this section Summary

Functions

Checks if the base option is valid

Checks if the callbacks option is valid

Checks if the index option is valid

Checks if the port option is valid

Checks if the webroot argument is valid

Link to this section Functions

Link to this function validate_base(base)
validate_base(term()) :: :ok | no_return()

Checks if the base option is valid.

Returns :ok if base is a string.

Raises ArgumentError otherwise.

Link to this function validate_callbacks(cb_mods)
validate_callbacks(term()) :: :ok | no_return()

Checks if the callbacks option is valid.

Returns :ok if callbacks is a list of atoms.

Raises ArgumentError if the list contains non-atom values, or callbacks is not a list.

Link to this function validate_index(index)
validate_index(term()) :: :ok | no_return()

Checks if the index option is valid.

Returns :ok if index is a boolean value.

Raises ArgumentError otherwise.

Link to this function validate_port(port)
validate_port(term()) :: :ok | no_return()

Checks if the port option is valid.

Returns :ok if port is a positive integer less than 65536.

Raises ArgumentError if port is not an integer, or the value is out of the acceptable range.

Link to this function validate_webroot(webroot)
validate_webroot(term()) :: :ok | no_return()

Checks if the webroot argument is valid.

Returns :ok if webroot is the path to an existing directory.

Raises ArgumentError if webroot is not a directory, or webroot is not a string value.