test: Clean up assert.throws tests

* Consistently pass a message.
* Use a simple Error instance for the regex test instead of
  CustomError.
* Move the assertion where expected is an object higher up.