Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 clarify LedgerError message when TAA is required and not accepted #2545

Merged

Conversation

ff137
Copy link
Contributor

@ff137 ff137 commented Oct 13, 2023

Previously:

            if await self.is_ledger_read_only():
                raise LedgerError(
                    "Error cannot write cred def when ledger is in read only mode"
                )

is_ledger_read_only also checks to see if TAA is required, and if not accepted it will also report the ledger is read-only:

    async def is_ledger_read_only(self) -> bool:
        """Check if ledger is read-only including TAA."""
        if self.read_only:
            return self.read_only
        # if TAA is required and not accepted we should be in read-only mode
        taa = await self.get_txn_author_agreement()
        if taa["taa_required"]:
            taa_acceptance = await self.get_latest_txn_author_acceptance()
            if "mechanism" not in taa_acceptance:
                return True
        return self.read_only

To make this clearer to the user, I updated the relevant error messages to say TAA may also be the cause of the LedgerError.

e.g.:

                raise LedgerError(
                    "Error cannot write cred def when ledger is in read only mode, "
                    "or TAA is required and not accepted"
                )

…d to read-only mode

Signed-off-by: ff137 <ff137@proton.me>
@sonarcloud
Copy link

sonarcloud bot commented Oct 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ff137 ff137 changed the title 🎨 clarify LedgerError message: 🎨 clarify LedgerError message when TAA is required and not accepted Oct 13, 2023
@swcurran swcurran merged commit 4c8f64a into openwallet-foundation:main Oct 13, 2023
9 checks passed
@ff137 ff137 deleted the art/improve-ledger-error-message branch July 4, 2024 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants