https://github.com/realyuniquename/jstack
Friendly stack traces for Haxe/JS and Haxe/PHP. Makes haxe.CallStack point to haxe sources.
https://github.com/realyuniquename/jstack
Last synced: 3 months ago
JSON representation
Friendly stack traces for Haxe/JS and Haxe/PHP. Makes haxe.CallStack point to haxe sources.
- Host: GitHub
- URL: https://github.com/realyuniquename/jstack
- Owner: RealyUniqueName
- License: mit
- Created: 2016-07-18T17:23:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-08-27T15:49:53.000Z (over 6 years ago)
- Last Synced: 2025-02-16T17:56:15.106Z (11 months ago)
- Language: Haxe
- Homepage:
- Size: 53.7 KB
- Stars: 31
- Watchers: 5
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JStack
This library automatically transforms `haxe.CallStack.callStack()`, `haxe.CallStack.exceptionStack()` and uncaught exceptions where possible to make them point at Haxe sources instead of generated js or php files.
The only supported targets are `js` and `php7` (as of 2017-02-24 you need latest development version of Haxe for php7 support).
Works only in debug mode or when `-D JSTACK_FORCE`.
Does not affect your app if compiled without `-debug` and `-D JSTACK_FORCE` flags or to unsupported target.
*2017-10-02 till Haxe 4 is released* if you want to use JStack for php target with the latest development version of Haxe, add `-D JSTACK_HAXE_DEV`.
## Installation
```haxe
haxelib install jstack
```
## Usage
Just add JStack to compilation with `-lib jstack` compiler flag.
## Clickable positions in stack traces.
If your IDE supports clickable file links in app output, you can specify a pattern for call stack entries:
```haxe
-D JSTACK_FORMAT=%symbol% at %file%:%line%
//or predefined pattern for VSCode
-D JSTACK_FORMAT=vscode
//or predefined pattern for IntelliJ IDEA
-D JSTACK_FORMAT=idea
```

## Custom entry point
If you don't have `-main` in your build config, then you need to specify entry point like this:
```
-D JSTACK_MAIN=my.SomeClass.entryPoint
```
If you want an entry point to return a value, add `-D JSTACK_ASYNC_ENTRY` to compilation flags.
It will switch JStack to loading sourcemap in background without blocking an entry point execution.
## Avoiding `process.exit` on NodeJS
By default JStack invokes `process.exit(1)` on uncaught exceptions in NodeJS environment. Use `-D JSTACK_NO_SHUTDOWN` to prevent this behavior.