Abstraction for creating custom JavaScript errors