cylc/cylc#79: fix cat-state error handling and centralise