Added custom exception and changed rest status codes