Fixed pipeline issues and added comment
This commit is contained in:
parent
b985aa283f
commit
e5f7df7318
2 changed files with 6 additions and 5 deletions
|
|
@ -69,7 +69,8 @@ public class IngredientsPopupCtrl {
|
|||
} catch (IOException e) {
|
||||
if (e.getMessage() != null && e.getMessage().startsWith("DUPLICATE:")) {
|
||||
showError("An ingredient with the name " + name + " already exists." +
|
||||
" Please provide a different name.");
|
||||
" Please provide a different name."); //checks if error received has the DUPLICATE string and creates a showError instance with an appropriate error message and description
|
||||
|
||||
} else {
|
||||
showError("Failed to create ingredient: " + e.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,9 +278,9 @@ public class ServerUtils {
|
|||
.build();
|
||||
|
||||
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
if (response.statusCode() == 409) {
|
||||
throw new IOException("An ingredient with the name '" + name + "' already exists.");
|
||||
final int DUPLICATE_STATUS_CODE = 409;
|
||||
if (response.statusCode() == DUPLICATE_STATUS_CODE) {
|
||||
throw new IOException("DUPLICATE: An ingredient with the name '" + name + "' already exists.");
|
||||
}
|
||||
|
||||
if (response.statusCode() != statusOK) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue