CB-3968 prettify error (#2862)

* CB-3968 prettify error

* CB-3968 return only rm error message

---------

Co-authored-by: Evgenia Bezborodova <139753579+EvgeniaBzzz@users.noreply.github.com>
This commit is contained in:
Ainur
2024-08-26 09:21:52 +00:00
committed by GitHub
co-authored by Evgenia Bezborodova
parent 00c1cc81ac
commit dfd5838f38
2 changed files with 4 additions and 1 deletions
@@ -630,6 +630,9 @@ public class LocalResourceController implements RMController {
}
Path newTargetPath = getTargetPath(projectId, normalizedNewResourcePath);
validateResourcePath(newTargetPath.toString());
if (Files.exists(newTargetPath)) {
throw new DBException("Resource with name %s already exists".formatted(newTargetPath.getFileName()));
}
try {
Files.move(oldTargetPath, newTargetPath);
} catch (IOException e) {
@@ -214,7 +214,7 @@ public class WebServiceRM implements DBWServiceRM {
WSResourceProperty.NAME);
return true;
} catch (Exception e) {
throw new DBWebException("Error moving resource " + oldResourcePath, e);
throw new DBWebException(e.getMessage(), e);
}
}