handle stack trace of exception in the proper way