Centralise error handling, cope with offline case