Use of HandleFailedApi() and Double messages fix

- Calling handleApiFailed() instead of communicate_api_failure()
- Fixes the double error message problem while in the exercises without loggin in.

Should address #1446 , #1695 and #1223