Catch APIError exceptions and display the error message

Signed-off-by: Maxime Petazzoni <max@signalfuse.com>