Skip to content

Commit

Permalink
Add more error details that are printed in case something goes wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
pverscha committed Aug 1, 2024
1 parent 3a730b5 commit 2cb8268
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/build_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ terminateAndExit() {
# Can be called when an error has occurred during the execution of the script. This function will inform the user that
# an error has occurred and will properly exit the script.
errorAndExit() {
local exit_status="$?" # Capture the exit status of the last command
local line_no=${BASH_LINENO[0]} # Get the line number where the error occurred
local command="${BASH_COMMAND}" # Get the command that was executed

echo "Error: the script experienced an error while trying to build the requested database." 1>&2
echo "Error: Command '$command' failed with exit status $exit_status at line $line_no."

if [[ -n "$1" ]]
then
echo "Error details: $1" 1>&2
Expand Down

0 comments on commit 2cb8268

Please sign in to comment.