Extracted out the Velocity handling error-page code.