Error handling for profile API

@rlucioni