add a top() function that catches exceptions and displays stack traces