Skip to content

Commit

Permalink
pr review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
annvelents committed Jul 23, 2024
1 parent 2e34143 commit 83534ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
12 changes: 3 additions & 9 deletions app/services/error_details/create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@

module ErrorDetails
class CreateService < BaseService
def initialize(params:, owner:, organization:, integration: nil)
super(params:, integration:, owner:, organization:)
end

def call
result = super
return result if result.error

res = create_error_details!
return res if res&.error
return result unless result.success?

res
create_error_details!
end

private

def create_error_details!
new_error = ErrorDetail.create(
new_error = ErrorDetail.create!(
integration:,
owner:,
organization:,
Expand Down
1 change: 1 addition & 0 deletions spec/services/error_details/create_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
expect(result.error_details.integration_id).to eq(nil)
expect(result.error_details.integration_type).to eq(nil)
expect(result.error_details.details).to eq(params[:details])
expect(result.error_details.error_code).to eq('not_provided')
end
end
end
Expand Down

0 comments on commit 83534ef

Please sign in to comment.