Skip to content

Commit

Permalink
v1.3.0 (#12)
Browse files Browse the repository at this point in the history
* 1.3.0
  • Loading branch information
kimung authored Dec 22, 2017
1 parent ea1f9f6 commit 743b9b3
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 36 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.3.0] - 2017-12-22
### Added
- start using CHANGELOG
### Changed
- use npm org in package name (rduk-errors -> @rduk/errors)
- update README
- update jasmine version (2.6.0 -> 2.8.0)
- update coveralls version (2.13.0 -> 3.0.0)
- update copyright
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Kim UNG
Copyright (c) 2016 - 2017 RDUK <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# RDUK - errors

[![Build Status](https://travis-ci.org/rd-uk/rduk-errors.svg?branch=master)](https://travis-ci.org/rd-uk/rduk-errors)
[![Coverage Status](https://coveralls.io/repos/github/rd-uk/rduk-errors/badge.svg?branch=master)](https://coveralls.io/github/rd-uk/rduk-errors?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/rd-uk/rduk-errors/badge.svg?branch=master)](https://coveralls.io/github/rd-uk/rduk-errors?branch=master) [![bitHound Overall Score](https://www.bithound.io/github/rd-uk/rduk-errors/badges/score.svg)](https://www.bithound.io/github/rd-uk/rduk-errors)

## Installation

```
npm install rduk-errors --save --save-exact
npm install @rduk/errors --save --save-exact
```

## Usage

```js
var errors = require('rduk-errors');
var errors = require('@rduk/errors');
```

You can instantiate a new error from the available errors. see the [list](#available_errors)
Expand Down Expand Up @@ -61,7 +61,7 @@ You can also add your own custom error
} (module));

/* main.js */
var errors = require('rduk-errors');
var errors = require('@rduk/errors');
errors.add('FakeError', require('pathToFakeError/FakeError'));

try {
Expand All @@ -72,7 +72,7 @@ try {

```

By default, your custom error inherits `BaseError`. The `BaseError` class is in charge
By default, your custom error inherits `BaseError`. The `BaseError` class is in charge
to initialize all error specific properties.

```js
Expand All @@ -96,7 +96,7 @@ to initialize all error specific properties.
But you can, if needed, inherit from your own custom error

```js
var errors = require('rduk-errors');
var errors = require('@rduk/errors');

errors.add('ChildFakeError', function ChildFakeError() {
ChildFakeError.super_.call(this, 'this is a fake error.');
Expand All @@ -117,3 +117,7 @@ try {
* `errors.ConfigurationError` ( `message` );
* `errors.NotImplementedError` ( `methodName` );
* `errors.NotSupportedError` ( `methodName` );

## License and copyright

See [LICENSE](LICENSE) file
4 changes: 2 additions & 2 deletions lib/factory.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -67,7 +67,7 @@
}

var hidden = '_' + name;

Object.defineProperty(factory, name, {
get: function() {
if (!factory.hasOwnProperty(hidden)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/type/ArgumentError.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -33,7 +33,7 @@
this,
util.format(
'Invalid argument "%s" (value: "%s").',
propertyName,
propertyName,
propertyValue));
};

Expand Down
2 changes: 1 addition & 1 deletion lib/type/ArgumentNullError.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/type/ArgumentOutOfRangeError.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/type/BaseError.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/type/ConfigurationError.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/type/NotImplementedError.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/type/NotSupportedError.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
{
"name": "rduk-errors",
"version": "1.2.3",
"name": "@rduk/errors",
"version": "1.3.0",
"description": "Custom Errors library for Node",
"main": "lib/factory.js",
"scripts": {
"lint": "jshint lib/**/*.js",
"pretest": "npm run lint",
"test": "istanbul cover jasmine",
"posttest": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
"test": "istanbul cover node_modules/jasmine/bin/jasmine.js --report cobertura",
"posttest": "istanbul report && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"author": "Kim UNG",
"author": "RDUK",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/rd-uk/rduk-errors"
},
"bugs": {
"url": "https://github.com/rd-uk/rduk-errors/issues"
},
"homepage": "https://github.com/rd-uk/rduk-errors#readme",
"keywords": [
"rduk",
"custom",
"errors",
"nodejs"
],
"devDependencies": {
"coveralls": "2.13.0",
"coveralls": "3.0.0",
"istanbul": "0.4.5",
"jasmine": "2.6.0",
"jshint": "2.9.5"
"jasmine": "2.8.0"
}
}
2 changes: 1 addition & 1 deletion spec/FakeError1.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion spec/FakeError2.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion spec/FakeError3.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions spec/errorsSpec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 Kim UNG
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('errors', function() {
describe('call with bad ctor', function() {
it('should throw an ArgumentError on error instantiation', function() {
expect(function() {
errors.add('UnknownError');
errors.add('UnknownError');
errors.throwUnknownError();
}).toThrowError(errors.ArgumentError);
});
Expand All @@ -122,7 +122,7 @@ describe('errors', function() {
describe('call with name and ctor as class path', function() {
it('should success', function() {
errors.add('FakeError1', path.resolve('spec/FakeError1'));

expect(function() {
errors.throwFakeError1();
}).toThrowError(errors.FakeError1);
Expand All @@ -132,7 +132,7 @@ describe('errors', function() {
describe('call with name and ctor as function', function() {
it('should success', function() {
errors.add('FakeError2', require('./FakeError2'));

expect(function() {
errors.throwFakeError2();
}).toThrowError(errors.FakeError2);
Expand All @@ -142,7 +142,7 @@ describe('errors', function() {
describe('call with custom base', function() {
it('should success', function() {
errors.add('FakeError3', require('./FakeError3'), errors.FakeError2);

expect(function() {
errors.throwFakeError3();
}).toThrowError(errors.FakeError3);
Expand All @@ -157,7 +157,7 @@ describe('errors', function() {
errors.add('FakeError4', function FakeError4() {
FakeError4.super_.call(this);
}, errors.FakeError3);

expect(function() {
errors.throwFakeError4();
}).toThrowError(errors.FakeError4);
Expand Down

0 comments on commit 743b9b3

Please sign in to comment.