RED-5293: 500 for invalid tenant
This commit is contained in:
parent
daf7dd6ba1
commit
aa54bb6f3b
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public class TenantRequest {
|
||||
|
||||
@NotNull
|
||||
@NotNull @NotBlank
|
||||
private String tenantId;
|
||||
@NotBlank
|
||||
private String displayName;
|
||||
|
||||
@ -90,6 +90,17 @@ public class TenantManagementService {
|
||||
}
|
||||
|
||||
|
||||
private void handleClientException(PSQLException e) {
|
||||
|
||||
if (e.getSQLState().equals("28000") || e.getSQLState().equals("28P01")) {
|
||||
throw new IllegalArgumentException("Database credentials are not correct. Please check them.");
|
||||
}
|
||||
if (SQL_CONNECTION_ERROR_CODES.contains(e.getSQLState())) {
|
||||
throw new IllegalArgumentException("Error when connecting to tenant database. Please check the jdbcUrl parameter.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void handleInternalException(PSQLException e) {
|
||||
|
||||
log.error(String.format("Connection to tenant DB failed with SQL state %s. Please check if the tenant DB is still running. " + //
|
||||
@ -98,17 +109,6 @@ public class TenantManagementService {
|
||||
}
|
||||
|
||||
|
||||
private void handleClientException(PSQLException e) {
|
||||
|
||||
if (e.getSQLState().equals("28000") || e.getSQLState().equals("28P01")) {
|
||||
throw new IllegalArgumentException("Database credentials are not correct. Please check them.", e);
|
||||
}
|
||||
if (SQL_CONNECTION_ERROR_CODES.contains(e.getSQLState())) {
|
||||
throw new IllegalArgumentException("Error when connecting to tenant database. Please check the jdbcUrl parameter.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<TenantResponse> getTenants() {
|
||||
|
||||
return tenantRepository.findAll().stream().map(this::convert).collect(Collectors.toList());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user