Open
Description
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.