mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
[ACS-9697] Added user-friendly error message. (#3371)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -747,7 +747,7 @@ public class CreateRulesTests extends RulesRestTest
|
|||||||
.createSingleRule(ruleModel);
|
.createSingleRule(ruleModel);
|
||||||
|
|
||||||
restClient.assertStatusCodeIs(NOT_FOUND);
|
restClient.assertStatusCodeIs(NOT_FOUND);
|
||||||
restClient.assertLastError().containsSummary("The entity with id: non-existent-node was not found");
|
restClient.assertLastError().containsSummary("Destination folder having Id: non-existent-node no longer exists. Please update your rule definition.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -75,6 +75,7 @@ public class ActionNodeParameterValidator implements ActionValidator
|
|||||||
static final String NO_PROPER_PERMISSIONS_FOR_NODE = "No proper permissions for node: ";
|
static final String NO_PROPER_PERMISSIONS_FOR_NODE = "No proper permissions for node: ";
|
||||||
static final String NOT_A_CATEGORY = "Node is not a category ";
|
static final String NOT_A_CATEGORY = "Node is not a category ";
|
||||||
static final String NOT_A_FOLDER = "Node is not a folder ";
|
static final String NOT_A_FOLDER = "Node is not a folder ";
|
||||||
|
static final String NO_LONGER_EXISTS = "%s having Id: %s no longer exists. Please update your rule definition.";
|
||||||
|
|
||||||
private final Actions actions;
|
private final Actions actions;
|
||||||
private final NamespaceService namespaceService;
|
private final NamespaceService namespaceService;
|
||||||
@@ -132,7 +133,15 @@ public class ActionNodeParameterValidator implements ActionValidator
|
|||||||
.filter(pd -> action.getParams().containsKey(pd.getName()))
|
.filter(pd -> action.getParams().containsKey(pd.getName()))
|
||||||
.forEach(p -> {
|
.forEach(p -> {
|
||||||
final String nodeId = Objects.toString(action.getParams().get(p.getName()), Strings.EMPTY);
|
final String nodeId = Objects.toString(action.getParams().get(p.getName()), Strings.EMPTY);
|
||||||
final NodeRef nodeRef = nodes.validateNode(nodeId);
|
NodeRef nodeRef;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
nodeRef = nodes.validateNode(nodeId);
|
||||||
|
}
|
||||||
|
catch (EntityNotFoundException e)
|
||||||
|
{
|
||||||
|
throw new EntityNotFoundException(String.format(NO_LONGER_EXISTS, p.getDisplayLabel(), nodeId), e);
|
||||||
|
}
|
||||||
validatePermission(action.getActionDefinitionId(), p.getName(), nodeRef);
|
validatePermission(action.getActionDefinitionId(), p.getName(), nodeRef);
|
||||||
validateType(action.getActionDefinitionId(), nodeRef);
|
validateType(action.getActionDefinitionId(), nodeRef);
|
||||||
});
|
});
|
||||||
@@ -169,4 +178,5 @@ public class ActionNodeParameterValidator implements ActionValidator
|
|||||||
throw new InvalidArgumentException(NOT_A_CATEGORY + nodeRef.getId());
|
throw new InvalidArgumentException(NOT_A_CATEGORY + nodeRef.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user