No-op refactor of barn-agent.cpp

This change moves the code around so that all error handling happens
in a single place. There should be no functional change with this,
but will allow adding failover on error behaviour in future.