trap exceptions in management command