Added custom exception handling for rest