Skip to content

Commit

Permalink
Distinguish the error types for xy end position
Browse files Browse the repository at this point in the history
The error could be due to:
* The end position not being greater than the start
* The end position being greater than the maximum size
  • Loading branch information
WilliamMcCumstie committed Aug 17, 2020
1 parent f02b6db commit 56b1071
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/flight_asset/credentials_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ def raise_if_known_422
end

if xy_end_position
raise ClientError, <<~ERROR.chomp
The #{xy_end_position} end position must be greater than the #{xy_end_position} start position
ERROR
if code == 'greater_than'
raise ClientError, <<~ERROR.chomp
The #{xy_end_position} end position must be greater than the #{xy_end_position} start position
ERROR
elsif code == 'less_than_or_equal_to'
raise ClientError, <<~ERROR.chomp
The #{xy_end_position} end position exceeds the maximum size of the parent
ERROR
end
end
end

Expand Down

0 comments on commit 56b1071

Please sign in to comment.