@breadhead/thunk-error
Advanced tools
Comparing version 1.0.2 to 1.0.3
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createErrorMiddleware = (supportsError, dispatchOnError) => (middleware) => (next) => (action) => next(action instanceof Function | ||
? addErrorHandling(middleware, supportsError, dispatchOnError)(action) | ||
: action); | ||
const addErrorHandling = (middleware, supportsError, dispatchOnError) => (fnAction) => (...args) => { | ||
const handleError = (err) => { | ||
exports.__esModule = true; | ||
exports.createErrorMiddleware = function (supportsError, dispatchOnError) { return function (middleware) { return function (next) { return function (action) { | ||
return next(action instanceof Function | ||
? addErrorHandling(middleware, supportsError, dispatchOnError)(action) | ||
: action); | ||
}; }; }; }; | ||
var addErrorHandling = function (middleware, supportsError, dispatchOnError) { return function (fnAction) { return function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
var handleError = function (err) { | ||
if (supportsError(err)) { | ||
middleware.dispatch(dispatchOnError()); | ||
return middleware.dispatch(dispatchOnError()); | ||
} | ||
throw err; | ||
}; | ||
let result; | ||
var result; | ||
try { | ||
result = fnAction(...args); | ||
result = fnAction.apply(void 0, args); | ||
} | ||
@@ -20,5 +27,5 @@ catch (err) { | ||
return result instanceof Promise | ||
? result.catch(handleError) | ||
? result["catch"](handleError) | ||
: result; | ||
}; | ||
}; }; }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@breadhead/thunk-error", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Middleware for handling errors in thunk", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "rimraf dist && tsc", | ||
"prepare": "install-self-peers -- --ignore-scripts && yarn build", | ||
"ci": "yarn test && yarn lint", | ||
"test": "jest", | ||
"lint": "tslint -p tsconfig.json -c tslint.json" | ||
"lint": "tslint -p tsconfig.json -c tslint.json", | ||
"pretty": "prettier --write \"lib/**/*.ts\"", | ||
"release": "standard-version" | ||
}, | ||
@@ -30,17 +32,55 @@ "repository": { | ||
"devDependencies": { | ||
"@commitlint/cli": "^7.3.2", | ||
"@commitlint/config-conventional": "^7.3.1", | ||
"@team-griffin/install-self-peers": "^1.1.1", | ||
"@types/jest": "^23.3.10", | ||
"@types/node": "^10.11.7", | ||
"cz-conventional-changelog": "^2.1.0", | ||
"husky": "^1.3.1", | ||
"jest": "^23.6.0", | ||
"lint-staged": "^8.1.0", | ||
"prettier": "^1.15.3", | ||
"rimraf": "^2.6.3", | ||
"standard-version": "^4.4.0", | ||
"ts-jest": "^23.10.5", | ||
"tslint": "^5.11.0", | ||
"tslint-config-prettier": "^1.17.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"typescript": "^3.1.3" | ||
}, | ||
"peerDependencies": { | ||
"redux": "^4.0.1" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged && yarn test", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.ts": [ | ||
"yarn pretty", | ||
"yarn lint", | ||
"git add" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"prettier": { | ||
"tabWidth": 2, | ||
"semi": false, | ||
"trailingComma": "all", | ||
"singleQuote": true | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"peerDependencies": { | ||
"redux": "^4.0.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6700
7
34
17