Skip to content

Commit

Permalink
preserve httpStatus for other reason on faild create of thing
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandar Stanchev <aleksandar.stanchev@bosch.com>
  • Loading branch information
alstanchev committed Oct 16, 2023
1 parent 670fb14 commit fe5675c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -113,8 +113,9 @@ public static Builder newBuilderForPolicyExisting(final ThingId thingId, final P
* @param reason the reason why the implicit policy creation failed.
* @return the builder.
*/
public static Builder newBuilderForOtherReason(final ThingId thingId, final PolicyId policyId, final String reason) {
return new Builder(thingId, policyId, reason);
public static Builder newBuilderForOtherReason(final HttpStatus httpStatus, final ThingId thingId, final PolicyId policyId, final String reason) {
return new Builder(thingId, policyId, reason)
.httpStatus(httpStatus);
}

/**
Expand Down
Expand Up @@ -425,7 +425,7 @@ private ThingNotCreatableException reportInitialPolicyCreationFailure(final Poli
.dittoHeaders(command.getDittoHeaders())
.build();
} else {
return ThingNotCreatableException.newBuilderForOtherReason(command.getEntityId(), policyId,
return ThingNotCreatableException.newBuilderForOtherReason(policyException.getHttpStatus(), command.getEntityId(), policyId,
policyException.getMessage())
.dittoHeaders(command.getDittoHeaders())
.build();
Expand Down

0 comments on commit fe5675c

Please sign in to comment.