Created
May 6, 2011 14:47
-
-
Save iande/959065 to your computer and use it in GitHub Desktop.
First Stab @ package_error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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