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

I see only a part of Debug.print messages for an one-way function #4041

Open
vporton opened this issue Dec 15, 2024 · 0 comments
Open

I see only a part of Debug.print messages for an one-way function #4041

vporton opened this issue Dec 15, 2024 · 0 comments
Labels
needs-triage This ticket needs investigation.

Comments

@vporton
Copy link
Contributor

vporton commented Dec 15, 2024

Code like this does not print the value of the exception:

    public shared({caller}) func installPackageWrapper({ // TODO: Rename.
        whatToInstall: {
            #package;
            #simplyModules : [(Text, Common.SharedModule)];
        };
        repo: Common.RepositoryPartitionRO;
        pmPrincipal: Principal;
        packageName: Common.PackageName;
        version: Common.Version;
        installationId: Common.InstallationId;
        preinstalledModules: [(Text, Principal)];
        user: Principal;
    }): () {
        try {
            Debug.print("R1");
            onlyOwner(caller, "installPackageWrapper");
            ...
            Debug.print("R2: " # debug_show(Iter.toArray(preinstalled2.entries())));
            // Throws an exception:
            let ?backend = preinstalled2.get("backend") else { // FIXME
                Debug.trap("error 1");
            };
            ...
            Debug.print("R3");
            ...
        };
        catch (e) {
            Debug.print("ONE installPackageWrapper");
            Debug.print("installPackageWrapper: " # Error.message(e));
        };
    };

Actually, it prints:

2024-12-15 16:53:47.297878369 UTC: [Canister 6cvy2-omaaa-aaaaa-qackq-cai] R1
2024-12-15 16:53:47.297878369 UTC: [Canister 6cvy2-omaaa-aaaaa-qackq-cai] R2: []
$ dfx --version
dfx 0.24.0

Apparently, we don't see messages printed by an one-way function produces by it right before its exit. This severely complicates debugging.

Sadly, to give you a repeatable bug code, I would need to disclose my closed source. Even if I did disclose it, to reprise the bug, need to follow a relatively complex GUI procedure, so it is not repeatable automatically.

@vporton vporton added the needs-triage This ticket needs investigation. label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage This ticket needs investigation.
Projects
None yet
Development

No branches or pull requests

1 participant