Updated all throw '<message>' to throw new Error('<message>') pattern.
Fixed typo in equivalent function