Added error handling and implemented a stack trace in console.