mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-23 06:00:47 -05:00
fix(http): keep snapshot names in one path segment and report odd server responses clearly (#54)
* fix(http): keep snapshot names in one path segment and report odd server responses clearly Snapshot names are URL-encoded and names that would change the path are refused; every trailing slash is stripped from the endpoint; a non-JSON body or a redirect gets a message that says so instead of a parser error; requests use HTTP/1.1. snapshot delete reports a missing snapshot API like save and load, save warns that --message is not sent yet, and export/import no longer cite a server version that does not exist. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(http): tell a missing snapshot API from its status, not from the error text The error message carries the request path, so a snapshot named nightly404 turned a real server error into 'not available'. FlociException now carries the HTTP status and the snapshot commands ask that. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
1 parent
1a7e84cd23
commit
24b4280f69
10 files changed
+289
-22
No files matched your search
@@ -47,7 +47,12 @@ public class SnapshotDeleteCommand implements Callable<Integer> {
|
||||
printer.println(Ansi.green("Snapshot deleted:") + " " + name);
|
||||
return 0;
|
||||
} catch (FlociException e) {
|
||||
printer.error("Failed to delete snapshot: " + e.getMessage());
|
||||
if (e.endpointMissing()) {
|
||||
printer.error("Snapshot API not available on this server version.\n" +
|
||||
"Track progress: " + profile.serverRepo() + "/issues");
|
||||
} else {
|
||||
printer.error("Failed to delete snapshot: " + e.getMessage());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user