Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jfresco committed Oct 24, 2016
0 parents commit 58d2dec
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015", "stage-0"]
}
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"parser": "babel-eslint",
"extends": ["standard"],
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true
},
"env": {
"browser": true,
"es6": true
},
"rules": {
"space-before-function-paren": [2, "never"],
"object-curly-spacing": [2, "always"],
"array-bracket-spacing": [2, "never"],
"valid-jsdoc": 2
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.log
node_modules
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Contributor guidelines
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# redux-bugsnag
Redux middleware that logs to Bugsnag
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "redux-bugsnag",
"version": "0.1.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "mkdir -p dist && babel src/index.js --out-file dist/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/restorando/redux-bugsnag.git"
},
"keywords": [
"redux",
"amplitude"
],
"contributors": [
"José Fresco <[email protected]>"
],
"license": "ISC",
"bugs": {
"url": "https://github.com/restorando/redux-bugsnag/issues"
},
"homepage": "https://github.com/restorando/redux-bugsnag#readme",
"dependencies": {
},
"devDependencies": {
"babel-cli": "^6.3.17",
"babel-core": "^6.3.17",
"babel-eslint": "^4.1.6",
"babel-loader": "^6.2.0",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"babel-runtime": "^6.3.19",
"eslint": "^1.10.3",
"eslint-config-standard": "^4.4.0",
"eslint-plugin-standard": "^1.3.1"
}
}
13 changes: 13 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import tap from 'redux-tap'

const filterError = ({ meta }) => meta && meta.error

const warn = () => window !== 'undefined' &&
typeof window.Bugsnag !== 'object' &&
console.warn('redux-bugsnag has been executed but it seems like Bugsnag snippet has not been loaded.')

export default () => tap(filterError, (error, action, store) => {
typeof window !== 'undefined' && typeof window.Bugsnag === 'object'
? window.Bugsnag.notifyException(error)
: warn()
})

0 comments on commit 58d2dec

Please sign in to comment.