Add error reporting to encryption