{"action":"created","issue":{"url":"https://api.github.com/repos/jeremyevans/sequel/issues/1003","labels_url":"https://api.github.com/repos/jeremyevans/sequel/issues/1003/labels{/name}","comments_url":"https://api.github.com/repos/jeremyevans/sequel/issues/1003/comments","events_url":"https://api.github.com/repos/jeremyevans/sequel/issues/1003/events","html_url":"https://github.com/jeremyevans/sequel/issues/1003","id":73035185,"number":1003,"title":"List Plugin :move_up / :move_down methods. Why raise \"Sequel::Error\" on out-of-bounds?","user":{"login":"kematzy","id":6571,"avatar_url":"https://avatars.githubusercontent.com/u/6571?v=3","gravatar_id":"","url":"https://api.github.com/users/kematzy","html_url":"https://github.com/kematzy","followers_url":"https://api.github.com/users/kematzy/followers","following_url":"https://api.github.com/users/kematzy/following{/other_user}","gists_url":"https://api.github.com/users/kematzy/gists{/gist_id}","starred_url":"https://api.github.com/users/kematzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kematzy/subscriptions","organizations_url":"https://api.github.com/users/kematzy/orgs","repos_url":"https://api.github.com/users/kematzy/repos","events_url":"https://api.github.com/users/kematzy/events{/privacy}","received_events_url":"https://api.github.com/users/kematzy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-04T14:29:51Z","updated_at":"2015-05-04T15:23:42Z","closed_at":null,"body":"Hi,\r\n\r\nI'm just curious why the `:move_down` & `:move_up` methods of the List plugin raises an \"Sequel::Error\" when going out of bounds?\r\n\r\nWhat is the smart intention I don't get?\r\n\r\nI my mind the \"least surprise\" principle would be to just set max / min positions and move to that position instead of throwing an error. A bit like this (quick example hack):\r\n\r\n    def move_up(n = 1)\r\n      min_pos = position_value - n\r\n      min_pos = 1 if min_pos < 1\r\n      move_to(min_pos) \r\n    end\r\n    # the above would be better handled in the `:move_to` method\r\n\r\nWhen moving an item up or down a list, it may not be fully known if we have already hit the min/max position. Or is there some smarter way to code which I cannot see atm?\r\n\r\nThanks for your time."},"comment":{"url":"https://api.github.com/repos/jeremyevans/sequel/issues/comments/98751464","html_url":"https://github.com/jeremyevans/sequel/issues/1003#issuecomment-98751464","issue_url":"https://api.github.com/repos/jeremyevans/sequel/issues/1003","id":98751464,"user":{"login":"jeremyevans","id":3846,"avatar_url":"https://avatars.githubusercontent.com/u/3846?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyevans","html_url":"https://github.com/jeremyevans","followers_url":"https://api.github.com/users/jeremyevans/followers","following_url":"https://api.github.com/users/jeremyevans/following{/other_user}","gists_url":"https://api.github.com/users/jeremyevans/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyevans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyevans/subscriptions","organizations_url":"https://api.github.com/users/jeremyevans/orgs","repos_url":"https://api.github.com/users/jeremyevans/repos","events_url":"https://api.github.com/users/jeremyevans/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyevans/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T15:23:42Z","updated_at":"2015-05-04T15:23:42Z","body":"I'm not sure the specific reasoning why `move_down` and `move_up` raise exceptions for out of bounds.  The list plugin wasn't written by me, it was taken from an external source.  However, one possible reason is it may make it simpler to catch unintentional errors.  But it seems friendly to me to just handle this automatically.\r\n\r\nSince this currently raises an exception, I don't think we'd be breaking backwards compatibility to change it to use the first or last position.  I'll try to make that change today."}}