# HG changeset patch # User Jakob Skjerning # Date 1249238530 -7200 # Node ID 7ac216b978a2e3db7d55ffd4901ea599459767b7 # Parent f22b5d28158e315d3cfb8bb154925eacee951348 More informative exception messages, less chatty debug output diff -r f22b5d28158e315d3cfb8bb154925eacee951348 -r 7ac216b978a2e3db7d55ffd4901ea599459767b7 app/controllers/github_hook_controller.rb --- a/app/controllers/github_hook_controller.rb Sun Aug 02 20:33:57 2009 +0200 +++ b/app/controllers/github_hook_controller.rb Sun Aug 02 20:42:10 2009 +0200 @@ -3,18 +3,16 @@ class GithubHookController < ApplicationController def index - logger.debug { "---------------------------------" } payload = JSON.parse(params[:payload]) logger.debug { "Received from Github: #{payload.inspect}" } - logger.debug { "Finding project" } + identifier = payload['repository']['name'] # For now, we assume that the repository name is the same as the project identifier - project = Project.find_by_identifier(payload['repository']['name']) - raise ActiveRecord::RecordNotFound if project.nil? || project.repository.nil? + project = Project.find_by_identifier(identifier) + raise ActiveRecord::RecordNotFound, "No project find with identifier '#{identifier}'" if project.nil? || project.repository.nil? - logger.debug { "Finding repo" } repository = project.repository - raise TypeError unless repository.is_a?(Repository::Git) + raise TypeError, "Repository for project '#{identifier}' is not a Git repository" unless repository.is_a?(Repository::Git) # Get updates from the Github repository command = "cd '#{repository.url}' && git pull"