https://github.com/jairussw/try-as
Exception Handling for AssemblyScript
https://github.com/jairussw/try-as
assemblyscript catching error exception handling safe
Last synced: 7 days ago
JSON representation
Exception Handling for AssemblyScript
- Host: GitHub
- URL: https://github.com/jairussw/try-as
- Owner: JairusSW
- License: mit
- Created: 2024-05-17T21:14:39.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-06T20:32:33.000Z (13 days ago)
- Last Synced: 2025-06-06T20:42:54.967Z (13 days ago)
- Topics: assemblyscript, catching, error, exception, handling, safe
- Language: TypeScript
- Homepage:
- Size: 283 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
████████ ██████ ██ ██ █████ ███████
██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ████ █████ ███████ ███████
██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ███████
AssemblyScript - v0.1.3-preview.1
## 📚 Contents
- [About](#-about)
- [Installation](#-installation)
- [Usage](#-usage)
- [License](#-license)
- [Contact](#-contact)## 📝 About
This library is an addon for AssemblyScript that brings JavaScript-like exception handling to the language, allowing you to use familiar `try/catch` syntax with a custom state management system. This allows AssemblyScript developers to write more readable, maintainable code, while retaining the performance benefits of WebAssembly.
## 🚨 Early Development
The exception handling is in the early stages of development. Its not recommended to use this library in production yet, but please, by all means, use it and if you find an issue, help improve it!
## 💾 Installation
```bash
npm install try-as
```Add the `--transform` to your `asc` command (e.g. in package.json)
```bash
--transform try-as/transform
```Alternatively, add it to your `asconfig.json`
```json
{
// ...
"options": { "transform": ["try-as/transform"] }
}
```If you'd like to see the code that the transform generates, run the build step with `DEBUG=true`
## 🪄 Usage
This library does all the work behind-the-scenes, so you, the developer, can use the classic `try/catch/finally` syntax with no changes!
```js
try {
abort("Failed to execute!", "test.ts");
console.log("This should not execute");
} catch (e) {
console.log("Got an error: " + e.toString());
} finally {
console.log("Gracefully shutting down...");
process.exit(0);
}
```## 📃 License
This project is distributed under an open source license. You can view the full license using the following link: [License](./LICENSE)
## 📫 Contact
Please send all issues to [GitHub Issues](https://github.com/JairusSW/as-json/issues) and to converse, please send me an email at [[email protected]](mailto:[email protected])
- **Email:** Send me inquiries, questions, or requests at [[email protected]](mailto:[email protected])
- **GitHub:** Visit the official GitHub repository [Here](https://github.com/JairusSW/as-json)
- **Website:** Visit my official website at [jairus.dev](https://jairus.dev/)
- **Discord:** Converse with me on [My Discord](https://discord.com/users/600700584038760448) or on the [AssemblyScript Discord Server](https://discord.gg/assemblyscript/)