Rather than have to put the function's name in the error mesage (and then forgetting to change it when I copy/paste/rename/modify it), here's a quick function that I can embed in the error message to spit out the function's name:

 function Get-FunctionName {
MyInvocation -Scope 1).Value.MyCommand.Name;

-scope 1 means to get it for the calling function, which is what we need.