Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Level/errors
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.5
Choose a base ref
...
head repository: Level/errors
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.1.0
Choose a head ref
  • 4 commits
  • 3 files changed
  • 3 contributors

Commits on Sep 10, 2017

  1. feat: add basic typings

    MeirionHughes committed Sep 10, 2017
    Copy the full SHA
    bc61d34 View commit details
  2. Merge pull request #8 from MeirionHughes/master

    feat: add basic typings
    ralphtheninja authored Sep 10, 2017
    Copy the full SHA
    6cb109e View commit details
  3. tweak readme

    ralphtheninja committed Sep 10, 2017
    Copy the full SHA
    64b4842 View commit details
  4. 1.1.0

    ralphtheninja committed Sep 10, 2017
    Copy the full SHA
    477e6f4 View commit details
Showing with 32 additions and 5 deletions.
  1. +5 −4 README.md
  2. +25 −0 errors.d.ts
  3. +2 −1 package.json
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,15 +3,16 @@

<img alt="LevelDB Logo" height="100" src="http://leveldb.org/img/logo.svg">

**Error module for [LevelUP](https://github.com/rvagg/node-levelup)**
> Error module for [LevelUP](https://github.com/rvagg/node-levelup)
[![Build Status](https://travis-ci.org/Level/errors.png)](https://travis-ci.org/Level/errors) [![Greenkeeper badge](https://badges.greenkeeper.io/Level/errors.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/Level/errors.png)](https://travis-ci.org/Level/errors)
[![Greenkeeper badge](https://badges.greenkeeper.io/Level/errors.svg)](https://greenkeeper.io/)

## Usage

```js
var levelup = require('levelup')
var errors = levelup.errors
const levelup = require('levelup')
const errors = levelup.errors

levelup('./db', { createIfMissing: false }, function (err, db) {
if (err instanceof errors.OpenError) {
25 changes: 25 additions & 0 deletions errors.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
interface LevelUPError extends Error { }
interface InitializationError extends LevelUPError { }
interface OpenError extends LevelUPError { }
interface ReadError extends LevelUPError { }
interface WriteError extends LevelUPError { }
interface NotFoundError extends Error { }
interface EncodingError extends LevelUPError { }

interface LevelUPErrorConstructor<TError> {
new(message?: string): TError;
(message?: string): TError;
readonly prototype: TError;
}

declare namespace levelerrors {
export var LevelUPError: LevelUPErrorConstructor<LevelUPError>;
export var InitializationError: LevelUPErrorConstructor<InitializationError>;
export var OpenError: LevelUPErrorConstructor<OpenError>;
export var ReadError: LevelUPErrorConstructor<ReadError>;
export var WriteError: LevelUPErrorConstructor<WriteError>;
export var NotFoundError: LevelUPErrorConstructor<NotFoundError>;
export var EncodingError: LevelUPErrorConstructor<EncodingError>;
}

export = levelerrors
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "level-errors",
"description": "Error types for LevelUP",
"version": "1.0.5",
"version": "1.1.0",
"contributors": [
"Rod Vagg <r@va.gg> (https://github.com/rvagg)",
"John Chesley <john@chesl.es> (https://github.com/chesles/)",
@@ -33,6 +33,7 @@
"errors"
],
"main": "errors.js",
"typings": "errors.d.ts",
"dependencies": {
"errno": "~0.1.1"
},