lib/exception_notifier/Bugzscout.rb
# send the response to FogBugz
# return true if all goes well
# throw a BugzScoutError exception along with the error text if otherwise.
send the response to FogBugz
return true if all goes well
throw a BugzScoutError exception along with the error text if otherwise.
send the response to FogBugz return true if all goes well throw a BugzScoutError exception along with the error text if otherwise .
def submit
      Rails.logger.info "FogBugz::BugzScout.submit"
      validate
      body = {
        :ScoutUserName => self.user,
        :ScoutProject => self.project,
        :ScoutArea => self.area,
        :Description => self.title,
        :ForceNewBug => self.forceNew,
        :Extra => self.body,
        :Email => self.email,
        :ScoutDefaultMessage => "",
        :FriendlyResponse => 0
      }
      begin
        Rails.logger.info "Calling FogBugz"
        response = Nestful.post(url, body).to_json
      rescue => e
        Rails.logger.fatal "#{e.message}:#{e.backtrace}"
        raise(BugzScoutError, e.message)
      end
      if response =~ /<Error>(.*)<\/Error>/
        Rails.logger.fatal "BugzScoutError:#{$1}"
        raise(BugzScoutError, $1)
      else
        Rails.logger.info "FogBugz success."
        return true
      end
    end
def submit Rails . logger . info "FogBugz::BugzScout.submit" validate body = { :ScoutUserName => self . user , :ScoutProject => self . project , :ScoutArea => self . area , :Description => self . title , :ForceNewBug => self . forceNew , :Extra => self . body , :Email => self . email , :ScoutDefaultMessage => "" , :FriendlyResponse => 0 } begin Rails . logger . info "Calling FogBugz" response = Nestful . post ( url , body ) . to_json rescue => e Rails . logger . fatal "#{e.message}:#{e.backtrace}" raise ( BugzScoutError , e . message ) end if response =~ / <Error>(.*)< \/ Error> / Rails . logger . fatal "BugzScoutError:#{$1}" raise ( BugzScoutError , $1 ) else Rails . logger . info "FogBugz success." return true end end
send the response to FogBugz
return true if all goes well
throw a BugzScoutError exception along with the error text if otherwise.
send the response to FogBugz return true if all goes well throw a BugzScoutError exception along with the error text if otherwise .
# ensure that the required fields are included # if we see an error response, we know that we fudged some of our input values to BugzScout # the error message should contain where we went wrong. # We raise the exception so the user can catch it and log if necessary.  No one likes things that fail silently! # we'll return 'true' for the sake of clarity