-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Consider adding a slug/code/number to JSON errors #4947
Description
Output of restic version
restic 0.16.4 compiled with go1.22.2 on linux/amd64
What should restic do differently? Which functionality do you think we should add?
When using --json, it would be nice if error messages could include a consistent-over-time indicator that consumers could key off of.
Having the error text is one thing! That's great for showing to users. But if you want to drive Restic at a policy layer, it helps to have a way to detect specific errors in a way that is resistant to string or locale changes.
I don't know the best approach to this! It's complicated. There's stuff like errno codes that could be surfaced? But then there's also custom errors that Restic generates. And a whole class of weird errors that might bubble up to Restic - how can it apply a consistent view of those to a consuming app? But I'd like it to. 😄
What are you trying to do? What problem would this solve?
I maintain a backup GUI called Deja Dup, which supports Restic. It is interested in detecting certain situations like "no space left on device" (and then offer / automatically delete snapshots to make room) or I dunno - some other sort of error in the future.
I can check the error string. But that's not as robust as I'd like. The string might change in the future. Or it might be translated based on locale.