chore(task): throw proper exception instead of a NullPointerException

related to CAM-3133