open-index/open-npm huggingface dataset:
npm package: @smallwins/begin-starter-app
Description: Basic starter app for Begin
Latest version: 1.3.0

# The Begin starter app

The `app/` directory contains the default app provisioned with new Begin apps. 🌈

(Everything in root is meta only!)


## Working with the app

To work with the app, cd into `app/` and run `npm i && npx hydrate`.

To reduce app provisioning time for initial onboarding, for the time being all logic within the starter app should be confined to the `src/http/get-index` function.

Begin itself relies on the starter app's `version` field being set to `0.0.0`, so any version updates should take place in the root `package.json` file. **`app/package.json` should always be set to version `0.0.0`.**

Minimize mutatation of the starter app during provisioning by Begin: do not add anything anywhere within `app/**` that isn't absolutely necessary!
npm package: @smallwins/err
Description: Slightly better custom Error
Author: Brian LeRoux
Latest version: 2.0.4

# `@smallwins/err`

Slightly better custom `Error`s

- Same runtime interface: just pass a message to the constructor
- Respects `extends` with clean `name` and `stack` properties
- Adds `toObject` returns a plain object representation
- Bundles common HTTP error types with a `code` property

```bash
npm i @smallwins/err --save
```

### Bundled Error Types

- `err.Err` a base `Error` type intended for extending
- `err.InternalError` has a `code` property of `500`
- `err.DatabaseError` has a `code` property of `500`
- `err.NotFoundError` has a `code` property of `404`
- `err.NotAuthorizedError` has a `code` property of `403`

## Usage

Example usage:

```javascript
var err = require('@smallwins/err')

let notFound = new err.NotFoundError('missing record')
console.log(err.code) // logs 404
```

Subclass to add additional properties such as `code`:

```javascript
var err = require('@smallwins/err')

class CoffeeError extends err.Err {
  constructor(params) {
    super(params)
    this.code = 500
  }
}

let e = new CoffeeError('lactose intolerant')
console.log(e.code) // logs 500
```

Get a clean representation:

```javascript
console.log(e.toObject())
// logs {name, code, message, stack}
```

Extend by `require`ing error directly:

```javascript
var Err = require('@smallwins/err/err')

class TerribleError extends Err {
  constructor(msg) {
    super(msg)
    this.extra = 'extra info'
  }
}

var e = new TerribleError('wut')
console.log(e.extra)
```

Work oldschool without `new`:

```javascript
var err = require('@smallwins/err/oldschool')

console.log(err.Err('basic') instanceof Error)
// logs true

console.log(err.NotFound('not found err').toString())
// logs NotFound: not found err
```

### `@smallwins/err/oldschool` API

Factory functions which return real `Error` instances:

- `err.Err` returns an `Err` instance
- `err.Internal` returns an `InternalError` instance
- `err.Database` returns a `DatabaseError` instance
- `err.NotFound` returns a `NotFoundError` instance
- `err.NotAuthorized` returns a `NotAuthorizedError` instance

---

Runtime type checking fully supported. Check the tests.