Commits

Anonymous committed 62f1488

Fix typo, improve error handling

Comments (0)

Files changed (1)

app/controllers/github_hook_controller.rb

     identifier = payload['repository']['name']
     # For now, we assume that the repository name is the same as the project identifier
     project = Project.find_by_identifier(identifier)
-    raise ActiveRecord::RecordNotFound, "No project find with identifier '#{identifier}'" if project.nil? || project.repository.nil?
+    raise ActiveRecord::RecordNotFound, "No project found with identifier '#{identifier}'" if project.nil?
+    raise TypeError, "Project '#{identifier}' has no repository" if project.repository.nil?
     
     repository = project.repository
     raise TypeError, "Repository for project '#{identifier}' is not a Git repository" unless repository.is_a?(Repository::Git)