adjust contract library to call raise-argument-error instead of error

and a few other changes nearby to clean up various things

closes PR 13623