Skip to content

Commit

Permalink
Merge pull request #1776 from bosch-io/bugfix/preserve-exception-stat…
Browse files Browse the repository at this point in the history
…us-code

Preserve original error http status code
  • Loading branch information
thjaeckle authored Oct 16, 2023
2 parents b9f957f + fe5675c commit d75deef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 d75deef

Please sign in to comment.