chore: Fix RestClient::GatewayTimeout, label_list of NilClass (#1243)
This commit is contained in:
parent
646746aa10
commit
74d07c876e
3 changed files with 11 additions and 7 deletions
|
@ -1,14 +1,18 @@
|
||||||
class Api::V1::Widget::LabelsController < Api::V1::Widget::BaseController
|
class Api::V1::Widget::LabelsController < Api::V1::Widget::BaseController
|
||||||
def create
|
def create
|
||||||
|
if conversation.present?
|
||||||
conversation.label_list.add(permitted_params[:label])
|
conversation.label_list.add(permitted_params[:label])
|
||||||
conversation.save!
|
conversation.save!
|
||||||
|
end
|
||||||
|
|
||||||
head :no_content
|
head :no_content
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
if conversation.present?
|
||||||
conversation.label_list.remove(permitted_params[:id])
|
conversation.label_list.remove(permitted_params[:id])
|
||||||
conversation.save!
|
conversation.save!
|
||||||
|
end
|
||||||
|
|
||||||
head :no_content
|
head :no_content
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,6 @@ class ContactAvatarJob < ApplicationJob
|
||||||
avatar_resource = LocalResource.new(avatar_url)
|
avatar_resource = LocalResource.new(avatar_url)
|
||||||
contact.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding)
|
contact.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding)
|
||||||
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError, NoMethodError => e
|
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError, NoMethodError => e
|
||||||
Rails.logger.info "invalid url #{avatar_url} : #{e.message}"
|
Rails.logger.info "Exception: invalid avatar url #{avatar_url} : #{e.message}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class Webhooks::Trigger
|
class Webhooks::Trigger
|
||||||
def self.execute(url, payload)
|
def self.execute(url, payload)
|
||||||
RestClient.post(url, payload.to_json, { content_type: :json, accept: :json })
|
RestClient.post(url, payload.to_json, { content_type: :json, accept: :json })
|
||||||
rescue RestClient::NotFound => e
|
rescue RestClient::NotFound, RestClient::GatewayTimeout, SocketError => e
|
||||||
Rails.logger.info "invalid url #{url} : #{e.message}"
|
Rails.logger.info "Exception: invalid webhook url #{url} : #{e.message}"
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
Raven.capture_exception(e)
|
Raven.capture_exception(e)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue