Skip to content

Commit

Permalink
raising ArgumentError for circular dependency and self-linked contain…
Browse files Browse the repository at this point in the history
…ers rather than RuntimeError
  • Loading branch information
dharmamike committed Nov 7, 2014
1 parent 56db488 commit aaf7930
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/models/service_sorter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def sort(services)
def visit(n)
if @temporary_marked.include?(n[:name])
if get_service_names_for(n[:links]).include?(n[:name])
raise "An image can not link to itself: #{n[:name]}"
raise ArgumentError, "An image can not link to itself: #{n[:name]}"
else
raise "Circular import between #{n[:name]} and #{@temporary_marked}"
raise ArgumentError, "Circular import between #{n[:name]} and #{@temporary_marked}"
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/models/service_sorter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
end

it 'raises an exception' do
expect{ described_class.sort(services) }.to raise_error(RuntimeError, /image can not link to itself/)
expect{ described_class.sort(services) }.to raise_error(ArgumentError, /image can not link to itself/)
end

end
Expand All @@ -61,7 +61,7 @@
end

it 'raises an exception' do
expect{ described_class.sort(services) }.to raise_error(RuntimeError, /Circular import/)
expect{ described_class.sort(services) }.to raise_error(ArgumentError, /Circular import/)
end

end
Expand Down

0 comments on commit aaf7930

Please sign in to comment.