Skip to content

Commit

Permalink
Added error handling section in README
Browse files Browse the repository at this point in the history
  • Loading branch information
W4G1 committed Jan 4, 2024
1 parent 37b998f commit 4e6dd51
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ As with previous examples, the shared state is managed using `$claim` and `$uncl
### Using imports from external packages

When using external modules, you can dynamically import them by using the `import()` statement. This is useful when you want to use other packages within a threaded function.
When using external modules, you can dynamically import them by using `yield "some-package"`. This is useful when you want to use other packages within a threaded function.

```js
import { threaded } from "multithreading";
Expand All @@ -140,3 +140,8 @@ You can also import external modules in a variety of other ways:
const { v4 } = yield "npm:uuid"; // Using npm specifier (available in Deno)
const { v4 } = yield "https://esm.sh/uuid"; // From CDN url (available in browser and Deno)
```
## Enhanced Error Handling
Errors inside threads are automatically injected with a pretty stack trace.
This makes it easier to identify which line of your function caused the error, and in which thread the error occured.
![Example of an enhanced stack trace](https://github.com/W4G1/multithreading/assets/38042257/41581ecf-fb1e-4022-b002-f9a4159bb1a4)

0 comments on commit 4e6dd51

Please sign in to comment.