fix the exception handling in user repository