#!/bin/bash
# ---------------
# Error Handling
# ---------------

docker_name=$1

set -e
trap 'catch $? $LINENO' EXIT

catch() {
  echo "catching!"
  if [ "$1" != "0" ]; then
    # error handling goes here
    echo "Error $1 occurred on $2 in $PROGNAME"
  fi
}

docker -ti "$docker_name" /bin/bash