SubtleCrypto.decrypt - wrong password or corrupted cyphertext?

Using correct password the SubtleCrypto.decrypt works fine.

My problem is how to differentiate problems or errors if the
wrong password is supplied or the
password is correct but cyphertext is corrupt or
i am trying to decrypt cleartext or an
intentionally malformed cyphertext designed to reveal password ?

I cant find good examples on stackoverflow or google.
Big thanks for any links to relevant examples on dealing with errors ?

Thanks

Well, cryptography is a subtle topic ^^

I don’t think you can. After all, as far as I get it, the only way to tell whether you decrypted successfully is by checking the result: if it is well formatted (e.g. starts with a known sequence), you succeeded, otherwise you didn’t.

Say a is the clear text, b the key and c the encrypted data, then

c = a + b

later you take (supposibly) copies of c and b to recompute a copy of a:

a' = c' - b'

If a' != a, the only conclusion you get is that c' isn’t c, b' isn’t b, both, or that - wasn’t the inverse operation of +.