In the service code at work, we translate certain Exceptions into other exceptions before those exceptions bubble up to our customers. For example, we have code like
catch (FooException e) {
throw new BarException(e);
}
A team member has his code like
catch (FooException e) {
throw new BarException(e.getMessage());
}
Is there any difference between the two approaches and how it ultimately affects what Exception our customers see? What's the difference between forwarding just the message of the original exception and forwarding the original Exception object?