Propagate error status codes correctly 68/79568/1
authorTomas Cere <tomas.cere@pantheon.tech>
Wed, 16 Jan 2019 10:47:14 +0000 (11:47 +0100)
committerJakub Morvay <jakub.morvay@gmail.com>
Wed, 16 Jan 2019 10:53:15 +0000 (10:53 +0000)
All RestconfDocumentedExceptions were being incorrectly
reported with status code 50x since the status code was not
correctly forwared to the underlying WebApplicationException.

Change-Id: Ibe53c560053607abff665a2f36a524dece51a2fc
JIRA: NETCONF-511
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java

index 3f1f458fb31540fca75217b6c699ddd43a93fa63..fc1773e86d0b719d022c95eac9eef27626388edd 100644 (file)
@@ -156,7 +156,7 @@ public class RestconfDocumentedException extends WebApplicationException {
     }
 
     public RestconfDocumentedException(final Throwable cause, final RestconfError error) {
-        super(cause);
+        super(cause, error.getErrorTag().getStatusCode());
         Preconditions.checkNotNull(error, "RestconfError can't be null");
         errors = ImmutableList.of(error);
         status = null;