File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Core functions for any Bash program
1515* [ core.err_exists()] ( #coreerr_exists )
1616* [ core.panic()] ( #corepanic )
1717* [ core.print_stacktrace()] ( #coreprint_stacktrace )
18+ * [ core.print_die_fn()] ( #coreprint_die_fn )
1819* [ core.print_fatal_fn()] ( #coreprint_fatal_fn )
1920* [ core.print_error_fn()] ( #coreprint_error_fn )
2021* [ core.print_warn_fn()] ( #coreprint_warn_fn )
@@ -159,6 +160,15 @@ core.trap_add 'err_handler' ERR
159160
160161_ Function has no arguments._
161162
163+ ### core.print_die_fn()
164+
165+ Print a error message to standard error including the function name
166+ of the callee to standard error and die
167+
168+ #### Arguments
169+
170+ * ** $1** (string): message
171+
162172### core.print_fatal_fn()
163173
164174Print a fatal error message including the function name of the callee
Original file line number Diff line number Diff line change @@ -283,6 +283,15 @@ core.print_stacktrace() {
283283 fi
284284} >&2
285285
286+ # @description Print a error message to standard error including the function name
287+ # of the callee to standard error and die
288+ # @arg $1 string message
289+ core.print_die_fn () {
290+ local msg=" $1 "
291+
292+ core.print_die " ${FUNCNAME[1]} ()${msg: +" : " } $msg "
293+ }
294+
286295# @description Print a fatal error message including the function name of the callee
287296# to standard error
288297# @arg $1 string message
You can’t perform that action at this time.
0 commit comments