Custom Error type creation for JavaScript