aboutsummaryrefslogtreecommitdiff
path: root/addons.mozilla.org-fsd
diff options
context:
space:
mode:
Diffstat (limited to 'addons.mozilla.org-fsd')
-rwxr-xr-xaddons.mozilla.org-fsd/get-data/err42
1 files changed, 28 insertions, 14 deletions
diff --git a/addons.mozilla.org-fsd/get-data/err b/addons.mozilla.org-fsd/get-data/err
index 57ea542..bde5b02 100755
--- a/addons.mozilla.org-fsd/get-data/err
+++ b/addons.mozilla.org-fsd/get-data/err
@@ -1,6 +1,27 @@
#!/bin/bash
+# Copyright 2018 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# this file was generated from gen-err and meant to be sourced
-bash-trace() {
+err-allow() {
+ if [[ $1 ]]; then
+ echo "errallow help: Undo the complimentary errcatch function."
+ else
+ set +E +o pipefail; trap ERR
+ fi
+}
+err-bash-trace() {
local -i argc_index=0 frame i start=${1:-1} max_indent=8 indent
local source
local extdebug=false
@@ -16,7 +37,7 @@ bash-trace() {
fi
indent=$((frame-start+1))
indent=$((indent < max_indent ? indent : max_indent))
- printf "%${indent}s↳%sin \`%s" '' "$source" "${FUNCNAME[frame]}"
+ printf "%${indent}s↳%sin \`%s" '' "$source" "${FUNCNAME[frame]}"
if $extdebug; then
for ((i=argc_index-1; i >= argc_index-argc; i--)); do
printf " %s" "${BASH_ARGV[i]}"
@@ -25,21 +46,14 @@ bash-trace() {
echo \'
done
}
-errallow() {
- if [[ $1 ]]; then
- echo "errallow help: Undo the complimentary errcatch function."
- else
- set +E +o pipefail; trap ERR
- fi
-}
-errcatch() {
+err-catch() {
set -E; shopt -s extdebug
_err-trap() {
err=$?
exec >&2
set +x
echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}:in \`$BASH_COMMAND' returned $err"
- bash-trace 2
+ err-bash-trace 2
set -e
"${_errcatch_cleanup[@]}"
echo "$0: exiting with code $err"
@@ -48,7 +62,7 @@ errcatch() {
trap _err-trap ERR
set -o pipefail
}
-errexit() {
+err-exit() {
exec >&2
code=1
if [[ $@ ]]; then
@@ -62,8 +76,8 @@ errexit() {
fi
fi
echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
- bash-trace 2
+ err-bash-trace 2
echo "$0: exiting with code $code"
exit $err
}
-errcatch
+err-catch-function