# domain-supervisor

> runs co-routines in domains, handling exceptions

Latest version **0.3.1** (published 2014-12-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install domain-supervisor
pnpm add domain-supervisor
yarn add domain-supervisor
bun add domain-supervisor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2014-12-18 |
| First published | 2014-11-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | stevenzeiler |

## Links

- npm: https://www.npmjs.com/package/domain-supervisor
- Repository: https://github.com/stevenzeiler/domain-supervisor
- Issues: https://github.com/stevenzeiler/domain-supervisor/issues
- npm.io page: https://npm.io/package/domain-supervisor

## Recent versions

- 0.3.1 (latest) — 2014-12-18
- 0.3.0 — 2014-11-16
- 0.2.0 — 2014-11-16
- 0.1.0 — 2014-11-16

## README

# Domain Supervisor

Start co-routines bounded by domains for parallel error handling.

Inspired by Erlang Supervisor and Process classes that enable fault-
tolerant parallel applications by isolating co-routines from each other,
thus preventing exceptions in co-routines from crashing the main nodejs
process.

## Installation

    npm install domain-supervisor

## Usage

    var Supervisor = require('domain-supervisor').Supervisor;
    var Process = require('domain-supervisor').Process;

    var proc = new Process(myCoRoutine);
    var supervisor = new Supervisor();

    supervisor.run(proc, function(error, restart, crash) {
      if (true) {
        console.log('Handling error:', error.stack);
        console.log('restarting...');
        restart();
      } else {
        // never crash the unix process, but it is an option
        crash(error);
      }
    });

    function myCoRoutine() {
      var loops = 0;
      setInterval(function() {
        console.log('valuably crunching data');
        if (loops > 5) throw new Error('some terrible exception!'); 
      }, 1000);
    }

---
_Source: https://npm.io/package/domain-supervisor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
