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

Display Tact compilation errors #19

Open
novusnota opened this issue Mar 28, 2024 · 10 comments
Open

Display Tact compilation errors #19

novusnota opened this issue Mar 28, 2024 · 10 comments

Comments

@novusnota
Copy link

Observed behaviour

Upon compilation error, user sees a cryptic "Error while building" message in the log output. And that's it, no details.

Expected behavior or possible solutions

Tact compiler provides details on compilation errors and it would be nice to see them in the log output even if the stack trace is truncated.

@rahulyadav-57
Copy link
Member

The Tact compiler does not throw an errors in some cases; instead, it logs them to the console, as detailed in issue tact-lang/tact#262. As a temporary workaround, I have implemented a method to capture console.error outputs and display them in the Nujan log.

Please notify me if there are any issues with errors not being logged properly.

@novusnota
Copy link
Author

novusnota commented May 8, 2024

@rahulyadav-57 I think this shall be re-opened, as dump() and emit() are not logged anymore after updating to Tact 1.3.0. Probably, we need to revert the temporary workaround you made before

@rahulyadav-57
Copy link
Member

Hi @novusnota, I tested it and it works for me; could you help me to reproduce it?

@novusnota
Copy link
Author

novusnota commented May 9, 2024

Sure @rahulyadav-57, it works in init() and receive(), but doesn't work in (off-chain) getter functions get fun X()

@rahulyadav-57 rahulyadav-57 reopened this May 10, 2024
@rahulyadav-57
Copy link
Member

@novusnota Instead of intercepting the console which I did previously, which captures everything globally, I propose an alternative solution. We could replace the logger.js file after npm install in Nujan at node_modules/@tact-lang/compiler/dist/ with a custom logger that can dispatch events which can be capture by Nujan logger. This approach might provide more targeted and manageable event handling.

Something like

const disptachEvent = (type, args) => {
    const tactEvent = new CustomEvent("tactLogger", {
        detail: { data: args, type},
    });
    document.dispatchEvent(tactEvent);
    console[type](args);
}


exports.consoleLogger = {
    log: (message) => disptachEvent('log', message),
    error: (message) => disptachEvent('log', message),
};

What are your thoughts @anton-trunov on this?

@anton-trunov
Copy link

@rahulyadav-57 I think we should fix it in Tact itself

@anton-trunov
Copy link

anton-trunov commented May 10, 2024

In general I would strongly discourage patching things up. Please don't shy away from fixing things in the compiler or any other tool, i.e. where it's relevant

@rahulyadav-57
Copy link
Member

rahulyadav-57 commented May 10, 2024

I agree with you. But for the current or older version of Tact, how should we proceed?

@anton-trunov
Copy link

anton-trunov commented May 10, 2024

We can fix the current version of Tact, release it as v1.3.1 and require it should be the minimal Tact version for Nujan

@rahulyadav-57
Copy link
Member

Yes, that solution would resolve the issue. I'll make the changes and raise a PR. However, in Nujan, we plan to support multiple versions of Tact, including older versions as well.

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

No branches or pull requests

3 participants