Can you just define a function that takes the error string and the error mode?

This is a lot of copypasta between raise_notice and raise_deprecation.