-
Notifications
You must be signed in to change notification settings - Fork 146
Description
Summary
Current snapper error messages produced via SN_THROW are technically correct but user-hostile.
They often fail fast without telling the user:
- What snapper detected
- Which variables were involved
- What the next obvious corrective action is
- How to get help for the exact subcommand that failed
This request proposes enhanced error output that is still concise, but actionable.
Goals
- Make errors self-explanatory without requiring users to immediately read
man snapper - Expose relevant runtime variables (config, path, subcommand)
- Always suggest the correct scoped help, i.e.
snapper ${sub_function} --help - Do not change exit codes or program flow
- Keep output compatible with scripting (human-readable only on stderr)
Proposed Behavior
1. Context-aware SN_THROW output
When an error occurs, the output should include:
- The primary error (unchanged)
- Detected state (current config, path, etc.)
- Action hint
- Help hint, scoped to the subcommand
Example: snapper create-config
Currently
# snapper create-config ${Path}
Creating config failed (config already exists).This is technically true and practically useless.
Proposed
# snapper create-config ${Path}
Creating config failed (config already exists).
Detected state:
Config name : root
Subvolume : ${Path}
Hints:
- You can select a different config with: -c ${new_config}
- Existing configs can be listed with: snapper list-configs
Help:
snapper create-config --help
man snapperThis tells the user exactly what snapper already knows internally.
Example: Generic Pattern
Current (typical SN_THROW)
Operation failed.
Proposed Pattern
Operation failed.
Context:
Command : ${sub_function}
Config : ${config}
Target : ${path}
Help:
snapper ${sub_function} --help
Variable Disclosure (Minimal but Useful)
Suggested standard variables to include when available:
| Variable | Description |
|---|---|
${sub_function} |
Current snapper command |
${config} |
Active config (e.g. root) |
${path} |
Target subvolume/path |
${number} |
Snapshot number (if applicable) |
Important:
Only print variables that are actually resolved.
No N/A, no noise.
--help Support for Subcommands
The manpage already documents:
snapper --help
But users expect this to work:
snapper create-config --help
snapper delete --help
snapper rollback --helpRequest
Ensure all subcommands accept:
snapper ${sub_function} --helpand display command-scoped help, not global help.
If already implemented internally, error output should explicitly point users to it.
Why This Matters
- Snapper is often used during system recovery
- Errors happen when users are already stressed
- Better messages reduce:
- Support load
- Documentation lookups
- Trial-and-error runs
- This aligns with modern CLI UX (git, podman, systemd tools)
Bluntly put: Snapper already knows the answer. It just refuses to tell the user.
Let’s fix that.
Compatibility & Risk
- No behavior changes
- No output format changes for
--machine-readable - Only improves stderr messages
- Zero risk to existing workflows