mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
08.54.2018 4d0a5e8846bdcc95e35ebdf5ad7223130223132e
Display borg response on errors.
1 files modified
11 ■■■■■ changed files
borgbutler-core/src/main/java/de/micromata/borgbutler/BorgCommands.java 11 ●●●●● patch | view | raw | blame | history
borgbutler-core/src/main/java/de/micromata/borgbutler/BorgCommands.java
@@ -22,6 +22,9 @@
    public static RepoInfo info(BorgRepoConfig repoConfig) {
        String json = execute(repoConfig, "info", "--json");
        if (json == null) {
            return null;
        }
        RepoInfo repoInfo = JsonUtils.fromJson(RepoInfo.class, json);
        repoInfo.setOriginalJson(json);
        return repoInfo;
@@ -29,6 +32,9 @@
    public static RepoList list(BorgRepoConfig repoConfig) {
        String json = execute(repoConfig, "list", "--json");
        if (json == null) {
            return null;
        }
        RepoList repoList = JsonUtils.fromJson(RepoList.class, json);
        repoList.setOriginalJson(json);
        return repoList;
@@ -53,8 +59,11 @@
        log.info("Executing '" + borgCall + "'...");
        try {
            executor.execute(cmdLine, getEnvironment(repoConfig));
        } catch (IOException ex) {
        } catch (Exception ex) {
            log.error("Error while creating environment for borg call '" + borgCall + "': " + ex.getMessage(), ex);
            String response = outputStream.toString(Charset.forName("UTF-8"));
            log.error("Response: " + response);
            return null;
        }
        String json = outputStream.toString(Charset.forName("UTF-8"));
        return json;