Skip to content

Commit 2beee87

Browse files
committed
fix: Make 'core.err_print' internal
Doing this makes things easier as there are less 'print error' functions to choose from. And, the function is mostly internal anyways.
1 parent 0d1775a commit 2beee87

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ It can look redundant (compared to `if ! fn; then :; fi`) to define error functi
2727
- `core.err_set`
2828
- `core.err_clear`
2929
- `core.err_exists`
30-
- `core.err_print`
31-
- `core.err_print` (TODO: Make this internal)
3230

3331
### `print`
3432

docs/api.md

-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Core functions for any Bash program
1313
* [core.err_set()](#coreerr_set)
1414
* [core.err_clear()](#coreerr_clear)
1515
* [core.err_exists()](#coreerr_exists)
16-
* [core.err_print()](#coreerr_print)
1716
* [core.print_stacktrace()](#coreprint_stacktrace)
1817
* [core.print_error()](#coreprint_error)
1918
* [core.print_warn()](#coreprint_warn)
@@ -128,10 +127,6 @@ _does_ exist
128127

129128
_Function has no arguments._
130129

131-
### core.err_print()
132-
133-
Prints the current error stored
134-
135130
### core.print_stacktrace()
136131

137132
Prints stacktrace

pkg/src/public/bash-core.sh

+1-8
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,6 @@ core.err_exists() {
241241
fi
242242
}
243243

244-
# @description Prints the current error stored
245-
core.err_print() {
246-
printf '%s\n' 'Error found:'
247-
printf '%s\n' " ERRCODE: $ERRCODE" >&2
248-
printf '%s\n' " ERR: $ERR" >&2
249-
}
250-
251244
# @description Prints stacktrace
252245
# @noargs
253246
# @example
@@ -330,7 +323,7 @@ core.panic() {
330323
if core.err_exists; then
331324
core.err_print
332325
fi
333-
core.print_stacktrace
326+
core.util.err_print
334327
exit "$code"
335328
}
336329

pkg/src/util/util.sh

+7
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ core.util.trap_handler_common() {
3131
fi
3232
done; unset trap_func
3333
}
34+
35+
# @description Prints the current error stored
36+
core.util.err_print() {
37+
printf '%s\n' 'Error found:'
38+
printf '%s\n' " ERRCODE: $ERRCODE" >&2
39+
printf '%s\n' " ERR: $ERR" >&2
40+
}

0 commit comments

Comments
 (0)