Hi,

Looks like my mail was not clear. So providing additional information. (the 
last but one input in the below method).

I am looking for inputs on the format for "error-info" attribute, is there a 
particular format I need to follow as per ODL or it is upto me to define how I 
want it to be understood?.

RpcResultBuilder.java


    /**
     * Creates an RpcError with severity ERROR for reuse.
     *
     * @param errorType the conceptual layer at which the error occurred.
     * @param tag a short string that identifies the general type of error 
condition. See
     *        {@link RpcError#getTag} for a list of suggested values.
     * @param message a string suitable for human display that describes the 
error condition.
     * * @param applicationTag a short string that identifies the specific type 
of error condition.
     * @param info a string containing additional information to provide 
extended
     *        and/or implementation-specific debugging information.
     * @param cause the exception that triggered the error.
     *
     * @return an RpcError
     */
    public static RpcError newError(  final ErrorType errorType, final String 
tag, final String message,
            final String applicationTag, final String info, final Throwable 
cause ) {
        return new RpcErrorImpl( ErrorSeverity.ERROR, errorType,
                tag != null ? tag : "operation-failed", message, 
applicationTag, info, cause );
    }

Thanks
Hari


From: Harinath Mallepally
Sent: Tuesday, January 3, 2017 11:27 AM
To: controller-dev@lists.opendaylight.org
Subject: RPC error response - need info on error-info element in error response


Hi All,

Happy new year!. I got this question about the error-info field in error 
response. What is the format we need to create this text?

I see 
https://tools.ietf.org/html/rfc6241#a...<https://tools.ietf.org/html/rfc6241#appendix-A>
 having xml kind of syntax, but not sure if that is what works for ODL too.

Here is a sample error response for an RPC with xml format for error-info (I 
created string in this format).

{

  "errors": {

    "error": [

      {

        "error-type": "application",

        "error-tag": "data-missing",

        "error-message": "tp id given is not valid",

        "error-info": "<severity>error</severity>"

      }

    ]

  }

}


But when I add header "Accept: application/xml", the angular brackets are html 
encoded. Not sure if this is expected behavior.

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
    <error>
        <error-type>application</error-type>
        <error-tag>data-missing</error-tag>
        <error-message>tp id given is not valid</error-message>
        <error-info>&lt;severity&gt;error&lt;/severity&gt;</error-info>
    </error>
</errors>
_______________________________________________
controller-dev mailing list
controller-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/controller-dev

Reply via email to