import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.YangError;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.codec.YangInvalidValueException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Unchecked exception to communicate error information, as defined in the ietf restcong draft, to be sent to the
* @author Thomas Pantelis
*/
public class RestconfDocumentedException extends WebApplicationException {
- private static final Logger LOG = LoggerFactory.getLogger(RestconfDocumentedException.class);
private static final long serialVersionUID = 1L;
private final ImmutableList<RestconfError> errors;
if (cause instanceof YangError) {
final YangError error = (YangError) cause;
throw new RestconfDocumentedException(cause, new RestconfError(error.getErrorType().toNetconf(),
- // FIXME: this is a special-case until we have YangError.getTag()
- cause instanceof YangInvalidValueException ? ErrorTag.INVALID_VALUE : ErrorTag.MALFORMED_MESSAGE,
- error.getErrorMessage().orElse(null), error.getErrorAppTag().orElse(null)));
+ new ErrorTag(error.getErrorTag()), error.getErrorMessage().orElse(null),
+ error.getErrorAppTag().orElse(null)));
}
}