#!/usr/bin/bash
# Copyright 2019-2022 Alibaba Group Holding Limited.
# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause

set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'ret=$?; cmd=${last_command}; [ $ret -ne 0 ] && echo "\"${cmd}\" command failed with exit code $ret."' EXIT
