Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(inbound): always return health objects with error set #2352

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.camunda.connector.runtime.inbound.executable;

import io.camunda.connector.api.inbound.Health;
import io.camunda.connector.api.inbound.Health.Error;
import io.camunda.connector.api.inbound.ProcessElement;
import io.camunda.connector.runtime.core.config.InboundConnectorConfiguration;
import io.camunda.connector.runtime.core.inbound.InboundConnectorDetails;
Expand Down Expand Up @@ -268,13 +269,16 @@ private ActiveExecutableResponse mapToResponse(UUID id, RegisteredExecutable con
id,
null,
failed.data().connectorElements(),
Health.down("reason", failed.reason()),
Health.down(new Error("Activation failure", failed.reason())),
List.of());
case ConnectorNotRegistered ignored -> new ActiveExecutableResponse(
case ConnectorNotRegistered notRegistered -> new ActiveExecutableResponse(
id,
null,
ignored.data().connectorElements(),
Health.down("reason", "Connector not registered"),
notRegistered.data().connectorElements(),
Health.down(
new Error(
"Activation failure",
"Connector " + notRegistered.data().type() + " not registered")),
List.of());
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,8 @@ public static Health down(Error error) {
return new Health(Status.DOWN, error, null);
}

public static Health down(String key, Object value) {
return Health.status(Status.DOWN).detail(key, value);
}

public static Health down(Map<String, Object> details) {
return Health.status(Status.DOWN).details(details);
}

public static Health down(Error error, Map<String, Object> details) {
return Health.status(Status.DOWN).details(details);
return new Health(Status.DOWN, error, details);
}

public static Health down(Throwable ex) {
Expand All @@ -131,7 +123,7 @@ interface DetailsStep {
public static class Builder implements DetailsStep {
private final Health.Status status;
private Map<String, Object> details;
private Error error;
private final Error error;

private Builder(Status status, Error error) {
this.status = status;
Expand Down
Loading