private static void checkQueryParams(final boolean insertUsed, final boolean pointUsed, final String insert) {
if (pointUsed && !insertUsed) {
- throw new RestconfDocumentedException("Point parameter can't be used without Insert parameter.");
+ throw new RestconfDocumentedException("Point parameter can't be used without Insert parameter.",
+ RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
if (pointUsed && (insert.equals("first") || insert.equals("last"))) {
throw new RestconfDocumentedException(
- "Point parameter can be used only with 'after' or 'before' values of Insert parameter.");
+ "Point parameter can be used only with 'after' or 'before' values of Insert parameter.",
+ RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
}
insertUsed = true;
insert = entry.getValue().iterator().next();
} else {
- throw new RestconfDocumentedException("Insert parameter can be used only once.");
+ throw new RestconfDocumentedException("Insert parameter can be used only once.",
+ RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
break;
case "point":
pointUsed = true;
point = entry.getValue().iterator().next();
} else {
- throw new RestconfDocumentedException("Point parameter can be used only once.");
+ throw new RestconfDocumentedException("Point parameter can be used only once.",
+ RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
break;
default:
- throw new RestconfDocumentedException("Bad parameter for post: " + entry.getKey());
+ throw new RestconfDocumentedException("Bad parameter for post: " + entry.getKey(),
+ RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT);
}
}
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
+import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
import org.opendaylight.restconf.nb.rfc8040.references.SchemaContextRef;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.TransactionVarsWrapper;
default:
throw new RestconfDocumentedException(
"Used bad value of insert parameter. Possible values are first, last, before or after, "
- + "but was: " + insert);
+ + "but was: " + insert, RestconfError.ErrorType.PROTOCOL,
+ RestconfError.ErrorTag.BAD_ATTRIBUTE);
}
}
}