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

Proper exit codes usage #103

Closed
anton-trunov opened this issue Aug 23, 2024 · 0 comments
Closed

Proper exit codes usage #103

anton-trunov opened this issue Aug 23, 2024 · 0 comments
Assignees
Milestone

Comments

@anton-trunov
Copy link

Summary

Exit codes from 0 to 127 are reserved for TVM or FunC and from 128 to 255 for Tact. Only the range from 256 to 65535 is free for developer-defined exit codes.

Context

https://docs.tact-lang.org/book/exit-codes

Examples

// Bad example that illustrates the problem
contract Foo {
    const NotOwnerExitCode: Int = 128;
    receive("foobar") {
        nativeThrowUnless(self.NotOwnerExitCode, sender() == self.owner);
    }
}

Use instead:

contract Foo {
    const NotOwnerExitCode: Int = 256; // <-- exit code from the allowed range
    receive("foobar") {
        nativeThrowUnless(self.NotOwnerExitCode, sender() == self.owner);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants