Skip to content

Instantly share code, notes, and snippets.

@iande
Created May 6, 2011 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iande/959065 to your computer and use it in GitHub Desktop.
Save iande/959065 to your computer and use it in GitHub Desktop.
First Stab @ package_error
package_error()
{
local _message=$1
if [[ -z "${_message}" ]]
then
fail "Cannot print a package error as no message was provided."
fi
local _log=$2
if [[ -n ${_log} ]] && file_exists ${_log}
then # Append tail of error log to the error message.
local _num_lines=${3:-25} # Default the number of lines to 25
_message="${_message}\n\nTail of ${_log}:\n$( tail -n ${_num_lines} ${_log} )"
fi
error "${_message}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment