diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0ab2761 --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/LICENSE b/LICENSE index 5506d0a..e2d3721 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016 Kim UNG +Copyright (c) 2016 - 2017 RDUK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 3bcb195..eec5b11 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 { @@ -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 @@ -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.'); @@ -117,3 +117,7 @@ try { * `errors.ConfigurationError` ( `message` ); * `errors.NotImplementedError` ( `methodName` ); * `errors.NotSupportedError` ( `methodName` ); + +## License and copyright + +See [LICENSE](LICENSE) file diff --git a/lib/factory.js b/lib/factory.js index 0b8f1a2..caed3ca 100644 --- a/lib/factory.js +++ b/lib/factory.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -67,7 +67,7 @@ } var hidden = '_' + name; - + Object.defineProperty(factory, name, { get: function() { if (!factory.hasOwnProperty(hidden)) { diff --git a/lib/type/ArgumentError.js b/lib/type/ArgumentError.js index 5c516c0..6ffa274 100644 --- a/lib/type/ArgumentError.js +++ b/lib/type/ArgumentError.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,7 +33,7 @@ this, util.format( 'Invalid argument "%s" (value: "%s").', - propertyName, + propertyName, propertyValue)); }; diff --git a/lib/type/ArgumentNullError.js b/lib/type/ArgumentNullError.js index 1bbf578..0cf949b 100644 --- a/lib/type/ArgumentNullError.js +++ b/lib/type/ArgumentNullError.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/type/ArgumentOutOfRangeError.js b/lib/type/ArgumentOutOfRangeError.js index 8641449..73e1ab4 100644 --- a/lib/type/ArgumentOutOfRangeError.js +++ b/lib/type/ArgumentOutOfRangeError.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/type/BaseError.js b/lib/type/BaseError.js index bfcb3a2..1470982 100644 --- a/lib/type/BaseError.js +++ b/lib/type/BaseError.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/type/ConfigurationError.js b/lib/type/ConfigurationError.js index 9c3dc37..984b39f 100644 --- a/lib/type/ConfigurationError.js +++ b/lib/type/ConfigurationError.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/type/NotImplementedError.js b/lib/type/NotImplementedError.js index e4b61e6..947f880 100644 --- a/lib/type/NotImplementedError.js +++ b/lib/type/NotImplementedError.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/lib/type/NotSupportedError.js b/lib/type/NotSupportedError.js index 1625126..5566b41 100644 --- a/lib/type/NotSupportedError.js +++ b/lib/type/NotSupportedError.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 24c6218..dc49987 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,22 @@ { - "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", @@ -22,9 +24,8 @@ "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" } } diff --git a/spec/FakeError1.js b/spec/FakeError1.js index c3e2270..ac7547f 100644 --- a/spec/FakeError1.js +++ b/spec/FakeError1.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/spec/FakeError2.js b/spec/FakeError2.js index 5b9c859..3233e1a 100644 --- a/spec/FakeError2.js +++ b/spec/FakeError2.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/spec/FakeError3.js b/spec/FakeError3.js index c37f9c4..7fffcd7 100644 --- a/spec/FakeError3.js +++ b/spec/FakeError3.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/spec/errorsSpec.js b/spec/errorsSpec.js index c32f449..b5144e9 100644 --- a/spec/errorsSpec.js +++ b/spec/errorsSpec.js @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2016 Kim UNG + * Copyright (c) 2016 - 2018 RDUK * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -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); }); @@ -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); @@ -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); @@ -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); @@ -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);