Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVL error response enhancements and panic recovery #68

Merged
merged 4 commits into from
Nov 3, 2020

Commits on Oct 31, 2020

  1. Include CVL error info in the response

    If a REST request fails due to cvl error, all non-zero values from
    CVLErrorInfo object will be encoded in the "error-info" field of
    response data (RFC8040 section 7.1). The "error-info" value will be a
    josn object with one field "cvl-error", whose value will be an object
    containing data from CVLErrorInfo.
    
    "error-info": {
        "cvl-error": {
            "error-code":   <CVLErrorInfo.Code>,
            "description":  <CVLErrorInfo.CVLErrDetails>,
            "message":      <CVLErrorInfo.Msg>,
            "table-name":   <CVLErrorInfo.TableName>,
            "table-keys":   <CVLErrorInfo.Keys>,
            "field-name":   <CVLErrorInfo.Field>,
            "field-value":  <CVLErrorInfo.Value>,
        }
    }
    
    ErrAppTag and ConstraintErrMsg are not included here since they will
    be encoded in "error-app-tag" and "error-message" fields of the error
    object.
    
    The "error-info" may include other error details in future. Clients
    should check for the presence of "cvl-error" field to identify CVL
    error.
    
    Signed-off-by: Sachin Holla <sachin.holla@broadcom.com>
    sachinholla committed Oct 31, 2020
    Configuration menu
    Copy the full SHA
    9af64c5 View commit details
    Browse the repository at this point in the history
  2. Panic recovery for REST requests

    REST server recovers panicking request handlers to return an error
    status 500 (internal server error) to the clients. Writes an error log
    with "runtime error" prefix, which can be used to redirect such
    messages to the device console (requires rsyslog config enhancements).
    Previously, the panics would have abruptly closed client connection
    without proper logs or messages.
    sachinholla committed Oct 31, 2020
    Configuration menu
    Copy the full SHA
    5260872 View commit details
    Browse the repository at this point in the history
  3. REST server error log cleanup

    Changed REST server to log all client data validation and translib API
    errors as warnings. They need not be errors in client app's context.
    Errors returned by system APIs continue to get logged as error message.
    This helps better monitoring and filtering of log messages.
    sachinholla committed Oct 31, 2020
    Configuration menu
    Copy the full SHA
    3602053 View commit details
    Browse the repository at this point in the history
  4. go.sum update

    sachinholla committed Oct 31, 2020
    Configuration menu
    Copy the full SHA
    89c0038 View commit details
    Browse the repository at this point in the history