• azul's avatar
    fix: return 409 when approving redundant requests · 5e50d4f3
    azul authored
    We were responding with 500 and an error popup
    when a request was approved for an action that had already been performed.
    
    For example when approving the removal of a former member
    that had already left the group on their own
    we responded with a 500.
    
    This changes the response to 409 - conflict:
    `    This response is sent when a request conflicts with the current state of the server.`
    
    I was also considering 404 - especially for requests
    to remove a non-member.
    However a 404 for an update on a request
    would seem more like the request itself could not be found.
    
    This commit introduces the Request::PointlessAction exception.
    It will be raised by requests whos action has already been performed.
    
    It allows us to unify error handling on the controller level
    and detect the different errors in each request class
    and reraise them with a common more semantic error class.
    5e50d4f3
request_to_join_you.rb 1.27 KB