aboutsummaryrefslogtreecommitdiff
path: root/addons.mozilla.org-fsd/get-data/err
diff options
context:
space:
mode:
authordavid <public@beloved.name>2018-07-04 14:02:27 +0200
committerdavid <public@beloved.name>2018-07-04 14:02:27 +0200
commitc01f34aeaf95994f80f5b54cbc0b16c8bd0e7a6a (patch)
tree9a11feea2f854aab57c44b4421b312f47fa86fe4 /addons.mozilla.org-fsd/get-data/err
parent34c5361492af08024c49a5937a842fa482e1c6fa (diff)
Added license notice to the err files
Diffstat (limited to 'addons.mozilla.org-fsd/get-data/err')
-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