Browse Source

improved error reporting and debug tracing

Jaromil 4 years ago
parent
commit
c8c521309e
1 changed files with 15 additions and 10 deletions
  1. 15 10
      zuper

+ 15 - 10
zuper

@@ -133,8 +133,22 @@ fn() {
133 133
     fun="$@"
134 134
     req=()
135 135
     freq=()
136
+    func "$fun"
136 137
 }
137 138
 
139
+zerr() {
140
+    error "error in: ${fun:-$last_notice}"
141
+    [[ "$last_func"   = "" ]] || warn "called in: $last_func"
142
+    [[ "$last_act"    = "" ]] || warn "called in: $last_act"
143
+    [[ "$last_notice" = "" ]] || warn "called in: $last_notice"
144
+    # [[ "$fun"         = "" ]] || warn "called in: $fun"
145
+    TRAPEXIT() {
146
+        error "error reported, operation aborted."
147
+    }
148
+    return 1
149
+}
150
+
151
+
138 152
 ckreq reqck() {
139 153
     err=0
140 154
     for v in $req; do
@@ -153,19 +167,10 @@ ckreq reqck() {
153 167
             err=1
154 168
         }
155 169
     done
170
+    [[ $err == 1 ]] && zerr
156 171
     return $err
157 172
 }
158 173
 
159
-zerr() {
160
-    error "error in: ${fun:-$last_notice}"
161
-    [[ "$last_func"   = "" ]] || warn "called in: $last_func"
162
-    [[ "$last_act"    = "" ]] || warn "called in: $last_act"
163
-    [[ "$last_notice" = "" ]] || warn "called in: $last_notice"
164
-    [[ "$fun"         = "" ]] || warn "called in: $fun"
165
-    error "error reported, operation aborted."
166
-    return 1
167
-}
168
-
169 174
 zdump() {
170 175
     fn zdump
171 176
     [[ ${#vars} -gt 0 ]] && {