Currently, borg has only a few, rather generic return codes: 0 ok, 1 warning, 2 error, >=128 for termination due to signals.
This could be improved (preferably with a breaking release) by moving some stuff to more specific codes. Everything that has no specific code assigned stays at the current code.
First task is to go through the issue tracker and link to all issues talking about (more specific) error codes from here.
Then it needs some planning: what makes sense, what does not, ...
When planning is finished and there is some consensus, implementation can follow.