PASDK-568: added error check after calling encoder wrapper.