MDL-25500 Locking: Throw coding errors instead of using trigger_error.