Add custom message to thrown exception while maintaining stack trace in Java March 4, 2023 by Tarik Try: throw new Exception("transction: " + transNbr, E);