Debugging and Troubleshooting in Verse
When things don’t work as you expect in your Verse code, sometimes it's hard to understand what went wrong. For example, you can encounter:
- Runtime errors.
- Code executing in the wrong order.
- Processes taking longer than they should.
Any of these can cause your code to behave in unexpected ways and create problems in your experience. The act of diagnosing problems in your code is called debugging, and there are several different solutions you can use to fix and optimize your code.
Verse Runtime Errors
Your Verse code is analyzed both as you write it in the language server and when you compile it from the editor or Visual Studio Code. However, this semantic analysis alone can't catch all the possible problems you can encounter. When your code executes at runtime, you may trigger runtime errors. These will cause all further Verse code to stop executing, which may make your experience unplayable.
As an example, suppose you had some Verse code that did the following:
| | |
| --- | --- |
| | # Has the suspends specifier, so can be called in a loop expression. |
| | SuspendsFunction()<suspends>:void={} |
| | |
| | # Calls SuspendFunction forever without breaking or returning, |
| | # causing a runtime error due to an infinite loop. |
| | CausesInfiniteLoop()<suspends>:void= |
| | loop: |
| | SuspendsFunction() |
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.