Skip to content

Commit

Permalink
Error if the end position isn't greater than
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamMcCumstie committed Aug 17, 2020
1 parent 9c5ca67 commit d0c8368
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/flight_asset/credentials_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ def raise_if_known_422
#{Paint["#{Config::CACHE.app_name} show-container PARENT_CONTAINER", :yellow]}
ERROR
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
end
end

##
Expand All @@ -96,6 +102,20 @@ def xy_capacity
end
end

##
# @returns [String] if the error was due to the xEndPosition or yEndPosition
# @returns [Nil] if the error was not due to the xEndPosition or yEndPosition
def xy_end_position
case pointer
when "/data/relationships/xEndPosition/data"
'x'
when "/data/relationships/yEndPosition/data"
'y'
else
nil
end
end

##
# Returns true if the error was due to the parent container
def parent_container?
Expand Down

0 comments on commit d0c8368

Please sign in to comment.