Added ouputing in case of error with api