added the onError validation for the new schema