format file and catch curl exception

* format file
* catch curl exception