Java / Exception
How do I rethrow an exception with custom message without losing stack trace?
Exceptions are immutable and its message cannot be altered after they've been created. Try the below code snippet.
throw new Exception("Custom exception: " + messageId, originalException);
More Related questions...