Revert "Fix wrong error syntax."

This reverts commit b4d0ee0ae8948b747ff1a9c8380375310fd4fe24.
Fix constructor name.
Fix wrong syntax for error messages.
Use new TS syntax.