• Mahmood Ali's avatar
    api: acl bootstrap errors aren't 500 · fd66b9c9
    Mahmood Ali authored
    Noticed that ACL endpoints return 500 status code for user errors.  This
    is confusing and can lead to false monitoring alerts.
    
    Here, I introduce a concept of RPCCoded errors to be returned by RPC
    that signal a code in addition to error message.  Codes for now match
    HTTP codes to ease reasoning.
    
    ```
    $ nomad acl bootstrap
    Error bootstrapping: Unexpected response code: 500 (ACL bootstrap already done (reset index: 9))
    
    $ nomad acl bootstrap
    Error bootstrapping: Unexpected response code: 400 (ACL bootstrap already done (reset index: 9))
    ```
    fd66b9c9