Skip to content

inflated-goboscript/catch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

catch.gs

test demo Build Run /test/

Essentially a nice wrapper around the TW debugger

This is the baseline error handling library which is built for goboscript. It is designed to be used with inflator.

No dependencies.

Usage

  1. Use the try; procedure to enter a try block. This will prevent any errors from immediately raising.
  2. Catch any errors by error name using if catch("error name")
  3. End the try/catch block using validate_errors;. This will raise any uncaught exceptions.
try;
    say div(3, 0), 0.25;
if catch("ZeroDivisionError") {
    log caught_exception.message;
} validate_errors;

Note

All code within the try block WILL be executed, even if errors ocurr, unless it is raised with force: true!

This will immediately cause a breakpoint and stop_all, so there is no chance for any error catching. It is recommended to avoid this where possible.

Credits

...

Installation

Make sure you have inflator installed. It's installable from the gtp.

inflate install catch

add catch to your inflator.toml config:

[dependencies]
# ...
catch = "catch"

Development

use inflate install -e .:

  1. clone the respository: git clone https://github.com/inflated-goboscript/catch
  2. cd catch
  3. inflate install -e .
  4. cd test
  5. inflate
  6. goboscript build
  7. open test.sb3

About

Baseline error handling for inflated goboscript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •