fallback to throwing Error if creating DOMException fails

in all browsers I tries throwDOMException fails with an exception "TypeError: Illegal constructor."

since I couldn't find a way to fix it and it may work on some cases, I just check if it fails and throw a more generic Error exception instead.