├── app ├── .gitkeep ├── services │ └── rollbar.js └── instance-initializers │ └── rollbar.js ├── addon ├── .gitkeep ├── instance-initializers │ └── rollbar.js └── services │ └── rollbar.js ├── vendor └── .gitkeep ├── tests ├── helpers │ └── .gitkeep ├── unit │ ├── .gitkeep │ ├── config │ │ └── environment-test.js │ ├── instance-initializers │ │ └── rollbar-test.js │ └── services │ │ └── rollbar-test.js ├── integration │ └── .gitkeep ├── dummy │ ├── app │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── models │ │ │ └── .gitkeep │ │ ├── routes │ │ │ └── .gitkeep │ │ ├── components │ │ │ ├── .gitkeep │ │ │ ├── scroll-to │ │ │ │ ├── template.hbs │ │ │ │ └── component.js │ │ │ └── page-sections │ │ │ │ ├── header │ │ │ │ ├── template.hbs │ │ │ │ └── navbar │ │ │ │ │ └── template.hbs │ │ │ │ ├── examples │ │ │ │ └── template.hbs │ │ │ │ ├── documentation │ │ │ │ └── template.hbs │ │ │ │ ├── footer │ │ │ │ └── template.hbs │ │ │ │ └── getting-started │ │ │ │ └── template.hbs │ │ ├── controllers │ │ │ └── .gitkeep │ │ ├── templates │ │ │ └── index.hbs │ │ ├── router.js │ │ ├── app.js │ │ ├── index.html │ │ └── styles │ │ │ └── app.css │ ├── public │ │ ├── robots.txt │ │ ├── .DS_Store │ │ ├── favicon.png │ │ └── images │ │ │ ├── atom.png │ │ │ ├── logo.png │ │ │ ├── .DS_Store │ │ │ └── og-image.jpg │ ├── .DS_Store │ └── config │ │ ├── icons.js │ │ ├── optional-features.json │ │ ├── targets.js │ │ └── environment.js ├── .DS_Store ├── test-helper.js └── index.html ├── .watchmanconfig ├── .DS_Store ├── logo.png ├── index.js ├── .template-lintrc.js ├── .ember-cli ├── .eslintignore ├── .editorconfig ├── .gitignore ├── .npmignore ├── testem.js ├── CONTRIBUTING.md ├── config ├── deploy.js ├── environment.js └── ember-try.js ├── LICENSE.md ├── .eslintrc.js ├── .travis.yml ├── ember-cli-build.js ├── package.json └── README.md /app/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /addon/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/integration/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp", "dist"] 3 | } 4 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/.DS_Store -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/logo.png -------------------------------------------------------------------------------- /app/services/rollbar.js: -------------------------------------------------------------------------------- 1 | export { default } from 'ember-rollbar-client/services/rollbar'; 2 | -------------------------------------------------------------------------------- /tests/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | name: require('./package').name 5 | }; 6 | -------------------------------------------------------------------------------- /tests/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/tests/.DS_Store -------------------------------------------------------------------------------- /tests/dummy/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/tests/dummy/.DS_Store -------------------------------------------------------------------------------- /tests/dummy/app/components/scroll-to/template.hbs: -------------------------------------------------------------------------------- 1 | {{#if @label}} 2 | {{@label}} 3 | {{else}} 4 | {{yield}} 5 | {{/if}} -------------------------------------------------------------------------------- /tests/dummy/public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/tests/dummy/public/.DS_Store -------------------------------------------------------------------------------- /app/instance-initializers/rollbar.js: -------------------------------------------------------------------------------- 1 | export { default, initialize } from 'ember-rollbar-client/instance-initializers/rollbar'; 2 | -------------------------------------------------------------------------------- /tests/dummy/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/tests/dummy/public/favicon.png -------------------------------------------------------------------------------- /tests/dummy/public/images/atom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/tests/dummy/public/images/atom.png -------------------------------------------------------------------------------- /tests/dummy/public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/tests/dummy/public/images/logo.png -------------------------------------------------------------------------------- /tests/dummy/public/images/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/tests/dummy/public/images/.DS_Store -------------------------------------------------------------------------------- /tests/dummy/public/images/og-image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmberExperts/ember-rollbar-client/HEAD/tests/dummy/public/images/og-image.jpg -------------------------------------------------------------------------------- /tests/dummy/config/icons.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return { 3 | 'free-brands-svg-icons': [ 4 | 'github', 5 | ], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/index.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.template-lintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | extends: 'octane', 5 | rules: { 6 | 'attribute-indentation': false, 7 | 'no-inline-styles': false 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /tests/dummy/config/optional-features.json: -------------------------------------------------------------------------------- 1 | { 2 | "application-template-wrapper": false, 3 | "default-async-observers": true, 4 | "jquery-integration": false, 5 | "template-only-glimmer-components": true 6 | } 7 | -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import Application from '../app'; 2 | import config from '../config/environment'; 3 | import { setApplication } from '@ember/test-helpers'; 4 | import { start } from 'ember-qunit'; 5 | 6 | setApplication(Application.create(config.APP)); 7 | 8 | start(); 9 | -------------------------------------------------------------------------------- /tests/dummy/app/router.js: -------------------------------------------------------------------------------- 1 | import EmberRouter from '@ember/routing/router'; 2 | import config from './config/environment'; 3 | 4 | export default class Router extends EmberRouter { 5 | location = config.locationType; 6 | rootURL = config.rootURL; 7 | } 8 | 9 | Router.map(function() { 10 | }); 11 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # unconventional js 2 | /blueprints/*/files/ 3 | /vendor/ 4 | 5 | # compiled output 6 | /dist/ 7 | /tmp/ 8 | 9 | # dependencies 10 | /bower_components/ 11 | /node_modules/ 12 | 13 | # misc 14 | /coverage/ 15 | !.* 16 | 17 | # ember-try 18 | /.node_modules.ember-try/ 19 | /bower.json.ember-try 20 | /package.json.ember-try 21 | -------------------------------------------------------------------------------- /tests/dummy/config/targets.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const browsers = [ 4 | 'last 1 Chrome versions', 5 | 'last 1 Firefox versions', 6 | 'last 1 Safari versions' 7 | ]; 8 | 9 | const isCI = !!process.env.CI; 10 | const isProduction = process.env.EMBER_ENV === 'production'; 11 | 12 | if (isCI || isProduction) { 13 | browsers.push('ie 11'); 14 | } 15 | 16 | module.exports = { 17 | browsers 18 | }; 19 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Application from '@ember/application'; 2 | import Resolver from 'ember-resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from './config/environment'; 5 | 6 | export default class App extends Application { 7 | modulePrefix = config.modulePrefix; 8 | podModulePrefix = config.podModulePrefix; 9 | Resolver = Resolver; 10 | } 11 | 12 | loadInitializers(App, config.modulePrefix); 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.hbs] 17 | insert_final_newline = false 18 | 19 | [*.{diff,md}] 20 | trim_trailing_whitespace = false 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist/ 5 | /tmp/ 6 | 7 | # dependencies 8 | /bower_components/ 9 | /node_modules/ 10 | 11 | # misc 12 | /.env* 13 | /.pnp* 14 | /.sass-cache 15 | /connect.lock 16 | /coverage/ 17 | /libpeerconnection.log 18 | /npm-debug.log* 19 | /testem.log 20 | /yarn-error.log 21 | 22 | # ember-try 23 | /.node_modules.ember-try/ 24 | /bower.json.ember-try 25 | /package.json.ember-try 26 | -------------------------------------------------------------------------------- /tests/dummy/app/components/scroll-to/component.js: -------------------------------------------------------------------------------- 1 | import Component from '@ember/component'; 2 | import { next } from '@ember/runloop'; 3 | 4 | export default Component.extend({ 5 | tagName: 'a', 6 | offset: -65, 7 | 8 | click() { 9 | next(() => { 10 | let element = document.querySelector(this.get('href')); 11 | let position = element.offsetTop + this.get('offset'); 12 | 13 | window.scroll({ top: position, behavior: 'smooth' }); 14 | }); 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist/ 3 | /tmp/ 4 | 5 | # dependencies 6 | /bower_components/ 7 | 8 | # misc 9 | /.bowerrc 10 | /.editorconfig 11 | /.ember-cli 12 | /.env* 13 | /.eslintignore 14 | /.eslintrc.js 15 | /.git/ 16 | /.gitignore 17 | /.template-lintrc.js 18 | /.travis.yml 19 | /.watchmanconfig 20 | /bower.json 21 | /config/ember-try.js 22 | /CONTRIBUTING.md 23 | /ember-cli-build.js 24 | /testem.js 25 | /tests/ 26 | /yarn.lock 27 | .gitkeep 28 | 29 | # ember-try 30 | /.node_modules.ember-try/ 31 | /bower.json.ember-try 32 | /package.json.ember-try 33 | -------------------------------------------------------------------------------- /tests/unit/config/environment-test.js: -------------------------------------------------------------------------------- 1 | import { setupTest } from 'ember-qunit'; 2 | import { module, test } from 'qunit'; 3 | 4 | module('Unit | Config | environment', function(hooks) { 5 | setupTest(hooks); 6 | 7 | test('code_version has been set correctly', function(assert) { 8 | let versionRegexp = new RegExp(/^(.+)\+(.{7})$/); 9 | let config = this.owner.resolveRegistration('config:environment'); 10 | let codeVersion = config.emberRollbarClient.payload.client.javascript['code_version']; 11 | 12 | assert.ok(versionRegexp.test(codeVersion)); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/dummy/app/components/page-sections/header/template.hbs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/components/page-sections/examples/template.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Live Examples

5 |
6 | 7 |

COMING SOON

8 | 9 |
10 |
11 | 75% Complete 12 |
13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /testem.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | test_page: 'tests/index.html?hidepassed', 3 | disable_watching: true, 4 | launch_in_ci: [ 5 | 'Chrome' 6 | ], 7 | launch_in_dev: [ 8 | 'Chrome' 9 | ], 10 | browser_args: { 11 | Chrome: { 12 | ci: [ 13 | // --no-sandbox is needed when running Chrome inside a container 14 | process.env.CI ? '--no-sandbox' : null, 15 | '--headless', 16 | '--disable-dev-shm-usage', 17 | '--disable-software-rasterizer', 18 | '--mute-audio', 19 | '--remote-debugging-port=0', 20 | '--window-size=1440,900' 21 | ].filter(Boolean) 22 | } 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /addon/instance-initializers/rollbar.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export function initialize(appInstance) { 4 | let fastbootService = appInstance.lookup('service:fastboot'); 5 | let rollbarService = appInstance.lookup('service:rollbar'); 6 | let oldOnError = Ember.onerror || function() {}; 7 | 8 | Ember.onerror = (...args) => { 9 | oldOnError(...args); 10 | let enabled = rollbarService.get('enabled'); 11 | 12 | if (enabled) { 13 | rollbarService.error(...args); 14 | } 15 | 16 | if (!enabled || Ember.testing) { 17 | if (!fastbootService || !fastbootService.get('isFastBoot')) { 18 | throw args[0]; 19 | } 20 | } 21 | }; 22 | } 23 | 24 | export default { initialize }; 25 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How To Contribute 2 | 3 | ## Installation 4 | 5 | * `git clone ` 6 | * `cd my-addon` 7 | * `npm install` 8 | 9 | ## Linting 10 | 11 | * `npm run lint:hbs` 12 | * `npm run lint:js` 13 | * `npm run lint:js -- --fix` 14 | 15 | ## Running tests 16 | 17 | * `ember test` – Runs the test suite on the current Ember version 18 | * `ember test --server` – Runs the test suite in "watch mode" 19 | * `ember try:each` – Runs the test suite against multiple Ember versions 20 | 21 | ## Running the dummy application 22 | 23 | * `ember serve` 24 | * Visit the dummy application at [http://localhost:4200](http://localhost:4200). 25 | 26 | For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/). -------------------------------------------------------------------------------- /tests/dummy/app/components/page-sections/documentation/template.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

5 | Documentation & Configuration 6 |

7 |
8 |

An advanced way to get to know ember-rollbar-client better

9 | 10 | dcumentatin 11 | 12 |
13 |
14 |
15 |
-------------------------------------------------------------------------------- /config/deploy.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 'use strict'; 3 | 4 | module.exports = function(deployTarget) { 5 | const ENV = { 6 | build: {} 7 | // include other plugin configuration that applies to all deploy targets here 8 | }; 9 | 10 | if (deployTarget === 'development') { 11 | ENV.build.environment = 'development'; 12 | // configure other plugins for development deploy target here 13 | } 14 | 15 | if (deployTarget === 'staging') { 16 | ENV.build.environment = 'production'; 17 | // configure other plugins for staging deploy target here 18 | } 19 | 20 | if (deployTarget === 'production') { 21 | ENV.build.environment = 'production'; 22 | // configure other plugins for production deploy target here 23 | } 24 | 25 | // Note: if you need to build some configuration asynchronously, you can return 26 | // a promise that resolves with the ENV object instead of returning the 27 | // ENV object synchronously. 28 | return ENV; 29 | }; 30 | -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function codeVersion() { 4 | let gitRepoVersion = require('git-repo-version'); 5 | return gitRepoVersion({ shaLength: 7 }); 6 | } 7 | 8 | module.exports = function(environment, appConfig) { 9 | appConfig.emberRollbarClient = { 10 | enabled: environment !== 'test' && environment !== 'development', 11 | accessToken: '', 12 | verbose: true, 13 | captureUncaught: environment !== 'test', 14 | captureUnhandledRejections: environment !== 'test', 15 | payload: { 16 | environment: environment, 17 | client: { 18 | javascript: { 19 | source_map_enabled: true, 20 | code_version: codeVersion(), // returns app version in format: 2.4.0+06df23a 21 | // Optionally have Rollbar guess which frames the error was thrown from 22 | // when the browser does not provide line and column numbers. 23 | guess_uncaught_frames: true 24 | } 25 | } 26 | } 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /tests/dummy/app/components/page-sections/footer/template.hbs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/components/page-sections/header/navbar/template.hbs: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Github 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy Tests 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | {{content-for "test-head"}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for "head-footer"}} 18 | {{content-for "test-head-footer"}} 19 | 20 | 21 | {{content-for "body"}} 22 | {{content-for "test-body"}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {{content-for "body-footer"}} 31 | {{content-for "test-body-footer"}} 32 | 33 | 34 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'babel-eslint', 4 | parserOptions: { 5 | ecmaVersion: 2018, 6 | sourceType: 'module', 7 | ecmaFeatures: { 8 | legacyDecorators: true 9 | } 10 | }, 11 | plugins: [ 12 | 'ember' 13 | ], 14 | extends: [ 15 | 'eslint:recommended', 16 | 'plugin:ember/recommended' 17 | ], 18 | env: { 19 | browser: true 20 | }, 21 | rules: { 22 | 'ember/no-jquery': 'error' 23 | }, 24 | overrides: [ 25 | // node files 26 | { 27 | files: [ 28 | '.eslintrc.js', 29 | '.template-lintrc.js', 30 | 'ember-cli-build.js', 31 | 'index.js', 32 | 'testem.js', 33 | 'blueprints/*/index.js', 34 | 'config/**/*.js', 35 | 'tests/dummy/config/**/*.js' 36 | ], 37 | excludedFiles: [ 38 | 'addon/**', 39 | 'addon-test-support/**', 40 | 'app/**', 41 | 'tests/dummy/app/**' 42 | ], 43 | parserOptions: { 44 | sourceType: 'script' 45 | }, 46 | env: { 47 | browser: false, 48 | node: true 49 | }, 50 | plugins: ['node'], 51 | rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { 52 | // add your custom rules and overrides for node files here 53 | }) 54 | } 55 | ] 56 | }; 57 | -------------------------------------------------------------------------------- /tests/dummy/app/components/page-sections/getting-started/template.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Getting started

5 |

How to start with ember-rollbar-client

6 |
7 |
8 | 9 |

1. Instalation

10 | 11 |

Run: ember install ember-rollbar-client

12 |

Add access token to the config/environment.js:

13 |
14 |       module.exports = function(environment) {
15 |       var ENV = {
16 |       'emberRollbarClient': {
17 |           accessToken: 'rollbar-write-client-token',
18 |         };
19 |       };
20 | 
21 |       return ENV;
22 |     }
23 |     
24 | 25 |

2. Usage

26 | 27 |

That's all! Errors are logged automaticaly to your Rollbar app.

28 | 29 |

3. Configuration

30 | If you need more configurations options or want to get control over logger, check out our documentation. 31 |
32 |
-------------------------------------------------------------------------------- /addon/services/rollbar.js: -------------------------------------------------------------------------------- 1 | import { getOwner } from '@ember/application'; 2 | import { computed } from '@ember/object'; 3 | import Service from '@ember/service'; 4 | import deepMerge from 'lodash.merge'; 5 | import Rollbar from 'rollbar'; 6 | 7 | export default Service.extend({ 8 | enabled: computed({ 9 | get() { 10 | return this.get('config.enabled'); 11 | }, 12 | 13 | set(key, value) { 14 | this.get('notifier').configure({ enabled: value }); 15 | return value; 16 | } 17 | }), 18 | 19 | currentUser: computed({ 20 | set(key, value) { 21 | this.get('notifier').configure({ payload: { person: value } }); 22 | return value; 23 | } 24 | }), 25 | 26 | notifier: computed(function() { 27 | return this.rollbarClient(); 28 | }).readOnly(), 29 | 30 | config: computed(function() { 31 | return getOwner(this).resolveRegistration('config:environment').emberRollbarClient; 32 | }).readOnly(), 33 | 34 | rollbarClient(customConfig = {}) { 35 | let config = deepMerge({}, this.get('config'), customConfig); 36 | return new Rollbar(config); 37 | }, 38 | 39 | // Notifications 40 | 41 | critical(...args) { 42 | return this.get('notifier').critical(...args); 43 | }, 44 | 45 | error(...args) { 46 | return this.get('notifier').error(...args); 47 | }, 48 | 49 | warning(...args) { 50 | return this.get('notifier').warning(...args); 51 | }, 52 | 53 | info(...args) { 54 | return this.get('notifier').info(...args); 55 | }, 56 | 57 | debug(...args) { 58 | return this.get('notifier').debug(...args); 59 | } 60 | }); 61 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | # we recommend testing addons with the same minimum supported node version as Ember CLI 5 | # so that your addon works for all apps 6 | - "10" 7 | 8 | sudo: false 9 | dist: trusty 10 | 11 | addons: 12 | chrome: stable 13 | 14 | cache: 15 | directories: 16 | - $HOME/.npm 17 | 18 | env: 19 | global: 20 | # See https://git.io/vdao3 for details. 21 | - JOBS=1 22 | 23 | branches: 24 | only: 25 | - master 26 | # npm version tags 27 | - /^v\d+\.\d+\.\d+/ 28 | 29 | jobs: 30 | fail_fast: true 31 | allow_failures: 32 | - env: EMBER_TRY_SCENARIO=ember-canary 33 | 34 | include: 35 | # runs linting and tests with current locked deps 36 | - stage: "Tests" 37 | name: "Tests" 38 | script: 39 | - npm run lint:hbs 40 | - npm run lint:js 41 | - npm test 42 | 43 | - stage: "Additional Tests" 44 | name: "Floating Dependencies" 45 | install: 46 | - npm install --no-package-lock 47 | script: 48 | - npm test 49 | 50 | # we recommend new addons test the current and previous LTS 51 | # as well as latest stable release (bonus points to beta/canary) 52 | - env: EMBER_TRY_SCENARIO=ember-lts-3.8 53 | - env: EMBER_TRY_SCENARIO=ember-lts-3.12 54 | - env: EMBER_TRY_SCENARIO=ember-release 55 | - env: EMBER_TRY_SCENARIO=ember-beta 56 | - env: EMBER_TRY_SCENARIO=ember-canary 57 | - env: EMBER_TRY_SCENARIO=ember-default-with-jquery 58 | - env: EMBER_TRY_SCENARIO=ember-classic 59 | 60 | script: 61 | - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO 62 | -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(environment) { 4 | let ENV = { 5 | modulePrefix: 'dummy', 6 | environment, 7 | rootURL: '/', 8 | locationType: 'auto', 9 | EmberENV: { 10 | FEATURES: { 11 | // Here you can enable experimental features on an ember canary build 12 | // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true 13 | }, 14 | EXTEND_PROTOTYPES: { 15 | // Prevent Ember Data from overriding Date.parse. 16 | Date: false 17 | } 18 | }, 19 | 20 | APP: { 21 | // Here you can pass flags/options to your application instance 22 | // when it is created 23 | }, 24 | 25 | emberRollbarClient: { 26 | accessToken: '3faf2b61902b4da59f30a010e1045a21' 27 | } 28 | }; 29 | 30 | if (environment === 'development') { 31 | // ENV.emberRollbarClient.enabled = true 32 | 33 | // ENV.APP.LOG_RESOLVER = true; 34 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 35 | // ENV.APP.LOG_TRANSITIONS = true; 36 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 37 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 38 | } 39 | 40 | if (environment === 'test') { 41 | // Testem prefers this... 42 | ENV.locationType = 'none'; 43 | 44 | // keep test console output quieter 45 | ENV.APP.LOG_ACTIVE_GENERATION = false; 46 | ENV.APP.LOG_VIEW_LOOKUPS = false; 47 | 48 | ENV.APP.rootElement = '#ember-testing'; 49 | ENV.APP.autoboot = false; 50 | } 51 | 52 | if (environment === 'production') { 53 | ENV.locationType = 'hash'; 54 | ENV.rootURL = '/ember-rollbar-client/'; 55 | } 56 | 57 | return ENV; 58 | }; 59 | -------------------------------------------------------------------------------- /ember-cli-build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 4 | 5 | const postcssPresetEnv = require('postcss-preset-env'); 6 | const postcssNested = require('postcss-nested'); 7 | const postcssImport = require('postcss-import') 8 | 9 | module.exports = function(defaults) { 10 | let config = defaults.project.config(EmberAddon.env()); 11 | 12 | let app = new EmberAddon(defaults, { 13 | sourcemaps: { enabled: true }, 14 | 15 | babel: { 16 | sourceMaps: 'inline' 17 | }, 18 | 19 | postcssOptions: { 20 | compile: { 21 | plugins: [ 22 | postcssImport, 23 | postcssNested, 24 | postcssPresetEnv, 25 | ] 26 | }, 27 | }, 28 | 29 | fingerprint: { 30 | exclude: ['apple-touch-icon', 'favicon', 'mstile'] 31 | }, 32 | 33 | favicons: { 34 | faviconsConfig: { 35 | appName: 'Ember Rollbar Client', 36 | appDescription: 'Ember Rollbar Client is a wrapper of automatic Rollbar logger for EmberJS applications.', 37 | developerName: 'Exelord', 38 | developerURL: 'www.macsour.com', 39 | background: '#ffffff', 40 | path: config.rootURL, // Path for overriding default icons path. `string` 41 | url: 'https://exelord.github.io/ember-rollbar-client/images/og-image.jpg', // Absolute URL for OpenGraph image. `string` 42 | } 43 | }, 44 | 45 | 'ember-bootstrap': { 46 | bootstrapVersion: 3, 47 | importBootstrapFont: true, 48 | importBootstrapCSS:false 49 | } 50 | }); 51 | 52 | /* 53 | This build file specifies the options for the dummy test app of this 54 | addon, located in `/tests/dummy` 55 | This build file does *not* influence how the addon or the app using it 56 | behave. You most likely want to be modifying `./index.js` or app's build file 57 | */ 58 | 59 | return app.toTree(); 60 | }; 61 | -------------------------------------------------------------------------------- /config/ember-try.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const getChannelURL = require('ember-source-channel-url'); 4 | 5 | module.exports = async function() { 6 | return { 7 | scenarios: [ 8 | { 9 | name: 'ember-lts-3.8', 10 | npm: { 11 | devDependencies: { 12 | 'ember-source': '~3.8.0' 13 | } 14 | } 15 | }, 16 | { 17 | name: 'ember-lts-3.12', 18 | npm: { 19 | devDependencies: { 20 | 'ember-source': '~3.12.0' 21 | } 22 | } 23 | }, 24 | { 25 | name: 'ember-release', 26 | npm: { 27 | devDependencies: { 28 | 'ember-source': await getChannelURL('release') 29 | } 30 | } 31 | }, 32 | { 33 | name: 'ember-beta', 34 | npm: { 35 | devDependencies: { 36 | 'ember-source': await getChannelURL('beta') 37 | } 38 | } 39 | }, 40 | { 41 | name: 'ember-canary', 42 | npm: { 43 | devDependencies: { 44 | 'ember-source': await getChannelURL('canary') 45 | } 46 | } 47 | }, 48 | // The default `.travis.yml` runs this scenario via `npm test`, 49 | // not via `ember try`. It's still included here so that running 50 | // `ember try:each` manually or from a customized CI config will run it 51 | // along with all the other scenarios. 52 | { 53 | name: 'ember-default', 54 | npm: { 55 | devDependencies: {} 56 | } 57 | }, 58 | { 59 | name: 'ember-default-with-jquery', 60 | env: { 61 | EMBER_OPTIONAL_FEATURES: JSON.stringify({ 62 | 'jquery-integration': true 63 | }) 64 | }, 65 | npm: { 66 | devDependencies: { 67 | '@ember/jquery': '^0.5.1' 68 | } 69 | } 70 | }, 71 | { 72 | name: 'ember-classic', 73 | env: { 74 | EMBER_OPTIONAL_FEATURES: JSON.stringify({ 75 | 'application-template-wrapper': true, 76 | 'default-async-observers': false, 77 | 'template-only-glimmer-components': false 78 | }) 79 | }, 80 | npm: { 81 | ember: { 82 | edition: 'classic' 83 | } 84 | } 85 | } 86 | ] 87 | }; 88 | }; 89 | -------------------------------------------------------------------------------- /tests/unit/instance-initializers/rollbar-test.js: -------------------------------------------------------------------------------- 1 | import { initialize } from 'ember-rollbar-client/instance-initializers/rollbar'; 2 | import { module, test } from 'qunit'; 3 | import { run } from '@ember/runloop'; 4 | import { getApplication } from '@ember/test-helpers/application'; 5 | 6 | import Ember from 'ember'; 7 | import Service from '@ember/service'; 8 | 9 | const onError = Ember.onerror; 10 | 11 | function createRollbarMock(assert, options = {}) { 12 | return Service.extend({ 13 | enabled: true, 14 | 15 | error(error) { 16 | assert.ok(true); 17 | assert.equal(error.message, 'foo'); 18 | } 19 | }, options); 20 | } 21 | 22 | module('Unit | Instance Initializer | rollbar', function(hooks) { 23 | hooks.beforeEach(function() { 24 | run(() => { 25 | this.application = getApplication() 26 | this.appInstance = this.application.buildInstance(); 27 | }); 28 | }); 29 | 30 | hooks.afterEach(function() { 31 | Ember.onerror = onError; 32 | run(this.appInstance, 'destroy'); 33 | }); 34 | 35 | test('register error handler for Ember errors', function(assert) { 36 | assert.expect(3); 37 | 38 | Ember.onerror = onError; 39 | let error = new Error('foo'); 40 | this.appInstance.register('service:rollbar', createRollbarMock(assert)); 41 | 42 | initialize(this.appInstance); 43 | assert.throws(() => Ember.onerror(error), error); 44 | }); 45 | 46 | test('error handler does not override previous hook', function(assert) { 47 | assert.expect(5); 48 | let error = new Error('foo'); 49 | this.appInstance.register('service:rollbar', createRollbarMock(assert)); 50 | 51 | Ember.onerror = function(error) { 52 | assert.ok(true); 53 | assert.equal(error.message, 'foo'); 54 | }; 55 | 56 | initialize(this.appInstance); 57 | assert.throws(() => Ember.onerror(error), error); 58 | }); 59 | 60 | test('error handler reacts on enabled state', function(assert) { 61 | assert.expect(7); 62 | let error = new Error('foo'); 63 | this.appInstance.register('service:rollbar', createRollbarMock(assert)); 64 | 65 | initialize(this.appInstance); 66 | assert.throws(() => Ember.onerror(error), error); 67 | 68 | this.appInstance.lookup('service:rollbar').set('enabled', false); 69 | initialize(this.appInstance); 70 | assert.throws(() => Ember.onerror(error), error); 71 | 72 | this.appInstance.lookup('service:rollbar').set('enabled', true); 73 | initialize(this.appInstance); 74 | assert.throws(() => Ember.onerror(error), error); 75 | }) 76 | }); 77 | -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ember Rollbar Client 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 32 | 33 | 34 | 44 | 45 | {{content-for "head"}} 46 | 47 | 48 | 49 | 50 | {{content-for "head-footer"}} 51 | 52 | 53 | {{content-for "body"}} 54 | 55 | 56 | 57 | 58 | {{content-for "body-footer"}} 59 | 60 | 61 | -------------------------------------------------------------------------------- /tests/unit/services/rollbar-test.js: -------------------------------------------------------------------------------- 1 | import { setupTest } from 'ember-qunit'; 2 | import { module, test } from 'qunit'; 3 | import Rollbar from 'rollbar'; 4 | 5 | module('Unit | Service | rollbar', function(hooks) { 6 | setupTest(hooks); 7 | 8 | test('it exists', function(assert) { 9 | let service = this.owner.lookup('service:rollbar'); 10 | assert.ok(service); 11 | }); 12 | 13 | test('enabled', function(assert) { 14 | let service = this.owner.lookup('service:rollbar'); 15 | assert.equal(service.get('enabled'), false); 16 | 17 | service.set('enabled', true) 18 | assert.equal(service.get('enabled'), true); 19 | assert.equal(service.get('notifier.options.enabled'), true); 20 | }); 21 | 22 | test('currentUser', function(assert) { 23 | let service = this.owner.lookup('service:rollbar'); 24 | assert.equal(service.get('currentUser'), null); 25 | 26 | let user = { name: 'User' }; 27 | service.set('currentUser', user); 28 | assert.equal(service.get('currentUser'), user); 29 | assert.equal(service.get('notifier.options.payload.person.name'), 'User'); 30 | }); 31 | 32 | test('new rollbar client - deep merge config', function(assert) { 33 | const config = this.owner.resolveRegistration('config:environment'); 34 | let { emberRollbarClient } = config; 35 | 36 | let newClient = this.owner.lookup('service:rollbar').rollbarClient({ 37 | payload: { 38 | client: { 39 | javascript: { 40 | source_map_enabled: false 41 | } 42 | } 43 | } 44 | }); 45 | 46 | assert.deepEqual(newClient.options.payload.client.javascript, { 47 | source_map_enabled: false, 48 | code_version: emberRollbarClient.payload.client.javascript.code_version, 49 | guess_uncaught_frames: true 50 | } , 'provided config is deep merged with default'); 51 | }); 52 | 53 | test('notifier', function(assert) { 54 | let service = this.owner.lookup('service:rollbar'); 55 | assert.ok(service.get('notifier') instanceof Rollbar); 56 | }); 57 | 58 | test('critical', function(assert) { 59 | let service = this.owner.lookup('service:rollbar'); 60 | let uuid = service.critical('My error message').uuid; 61 | assert.ok(uuid); 62 | }); 63 | 64 | test('error', function(assert) { 65 | let service = this.owner.lookup('service:rollbar'); 66 | let uuid = service.error('My error message').uuid; 67 | assert.ok(uuid); 68 | }); 69 | 70 | test('warning', function(assert) { 71 | let service = this.owner.lookup('service:rollbar'); 72 | let uuid = service.warning('My error message').uuid; 73 | assert.ok(uuid); 74 | }); 75 | 76 | test('info', function(assert) { 77 | let service = this.owner.lookup('service:rollbar'); 78 | let uuid = service.info('My error message').uuid; 79 | assert.ok(uuid); 80 | }); 81 | 82 | test('debug', function(assert) { 83 | let service = this.owner.lookup('service:rollbar'); 84 | let uuid = service.debug('My error message').uuid; 85 | assert.ok(uuid); 86 | }); 87 | }); 88 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-rollbar-client", 3 | "version": "0.11.0", 4 | "description": "The Rollbar client for Ember applications.", 5 | "keywords": [ 6 | "ember-addon", 7 | "rollbar", 8 | "client", 9 | "logger", 10 | "ember" 11 | ], 12 | "repository": "https://github.com/Exelord/ember-rollbar-client", 13 | "license": "MIT", 14 | "author": "Exelord (Maciej Kwaśniak)", 15 | "directories": { 16 | "test": "tests" 17 | }, 18 | "scripts": { 19 | "build": "ember build", 20 | "lint:hbs": "ember-template-lint .", 21 | "lint:js": "eslint .", 22 | "start": "ember server", 23 | "test": "ember test", 24 | "test:all": "ember try:each", 25 | "release": "release-it" 26 | }, 27 | "release-it": { 28 | "github": { 29 | "release": true, 30 | "releaseName": "v${version}" 31 | }, 32 | "git": { 33 | "tagName": "v${version}" 34 | }, 35 | "hooks": { 36 | "after:release": "ember deploy production" 37 | } 38 | }, 39 | "dependencies": { 40 | "ember-auto-import": "^1.5.3", 41 | "ember-cli-babel": "^7.13.0", 42 | "ember-cli-htmlbars": "^4.2.0", 43 | "git-repo-version": "^1.0.2", 44 | "lodash.merge": "^4.6.1", 45 | "release-it": "^14.2.0", 46 | "rollbar": "~2.24.0" 47 | }, 48 | "devDependencies": { 49 | "@ember/optional-features": "^1.1.0", 50 | "@fortawesome/ember-fontawesome": "^0.2.1", 51 | "@fortawesome/free-brands-svg-icons": "^5.12.0", 52 | "@glimmer/component": "^1.0.0", 53 | "babel-eslint": "^10.0.3", 54 | "bootstrap": "^3.4.1", 55 | "broccoli-asset-rev": "^3.0.0", 56 | "ember-bootstrap": "^3.1.1", 57 | "ember-cli": "~3.15.1", 58 | "ember-cli-dependency-checker": "^3.2.0", 59 | "ember-cli-deploy": "^1.0.2", 60 | "ember-cli-deploy-build": "^2.0.0", 61 | "ember-cli-deploy-git": "^1.3.4", 62 | "ember-cli-eslint": "5.1.0", 63 | "ember-cli-fastboot": "^2.0.4", 64 | "ember-cli-favicon": "^2.0.0", 65 | "ember-cli-github-pages": "^0.2.1", 66 | "ember-cli-inject-live-reload": "^2.0.1", 67 | "ember-cli-postcss": "^5.0.0", 68 | "ember-cli-sri": "^2.1.1", 69 | "ember-cli-template-lint": "^1.0.0-beta.3", 70 | "ember-cli-uglify": "^3.0.0", 71 | "ember-disable-prototype-extensions": "^1.1.3", 72 | "ember-export-application-global": "^2.0.1", 73 | "ember-load-initializers": "^2.1.1", 74 | "ember-maybe-import-regenerator": "^0.1.6", 75 | "ember-qunit": "^4.6.0", 76 | "ember-resolver": "^7.0.0", 77 | "ember-source": "~3.15.0", 78 | "ember-source-channel-url": "^2.0.1", 79 | "ember-try": "^1.4.0", 80 | "eslint-plugin-ember": "^7.7.1", 81 | "eslint-plugin-node": "^11.0.0", 82 | "loader.js": "^4.7.0", 83 | "postcss-import": "^12.0.1", 84 | "postcss-nested": "^4.2.1", 85 | "postcss-preset-env": "^6.7.0", 86 | "qunit-dom": "^0.9.2" 87 | }, 88 | "engines": { 89 | "node": "10.* || >= 12.*" 90 | }, 91 | "ember": { 92 | "edition": "octane" 93 | }, 94 | "ember-addon": { 95 | "configPath": "tests/dummy/config", 96 | "demoURL": "https://exelord.github.io/ember-rollbar-client/" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.css: -------------------------------------------------------------------------------- 1 | @import "bootstrap"; 2 | 3 | :root { 4 | --redColor: #00A8C5; 5 | --orangeColor: #FFFF7E; 6 | } 7 | 8 | .progress-bar { 9 | background-color: var(--redColor); 10 | } 11 | 12 | .navbar-brand { 13 | padding-top: 0px; 14 | padding-bottom: 0px; 15 | } 16 | 17 | .navbar-default { 18 | background-color: white; 19 | padding: 10px 0; 20 | } 21 | 22 | #header { 23 | padding-top: 150px; 24 | padding-bottom: 100px; 25 | background: linear-gradient(45deg, white 10%, var(--orangeColor) 50%, var(--redColor) 100%); 26 | 27 | .logo { 28 | max-width: 100%; 29 | max-height: 400px; 30 | } 31 | } 32 | 33 | #getting-started { 34 | padding: 80px 0; 35 | 36 | .pl-s { 37 | color: #183691; 38 | } 39 | .pl-c1 { 40 | color: #0086b3; 41 | } 42 | .pl-en { 43 | color: #795da3; 44 | } 45 | .pl-k { 46 | color: #a71d5d; 47 | } 48 | .pl-c { 49 | color: #969896; 50 | } 51 | .pl-v, .pl-smw { 52 | color: #ed6a43; 53 | } 54 | } 55 | 56 | code { 57 | color: var(--redColor); 58 | background-color: rgba(var(--redColor), 0.1); 59 | } 60 | 61 | #documentation { 62 | text-align: center; 63 | padding: 80px 0; 64 | text-transform: uppercase; 65 | background: linear-gradient(45deg, white 10%, var(--orangeColor) 50%, var(--redColor) 100%); 66 | } 67 | 68 | #examples { 69 | padding: 80px 0; 70 | 71 | pre { 72 | white-space: pre-line; 73 | } 74 | 75 | .section-heading { 76 | text-align: center; 77 | margin-bottom: 80px; 78 | } 79 | 80 | .activator, .example-intro { 81 | margin: 20px 0; 82 | } 83 | 84 | .nav-tabs { 85 | margin-bottom: 20px; 86 | } 87 | } 88 | 89 | .btn-outline { 90 | background-color: transparent; 91 | color: inherit; 92 | transition: all .5s; 93 | border: black 1px solid; 94 | 95 | &.disabled { 96 | border-color: #777 !important; 97 | color: #777 !important; 98 | } 99 | 100 | &:hover,&:focus,&:active { 101 | background-color: transparent !important; 102 | } 103 | } 104 | 105 | .btn-default.btn-outline:hover { 106 | border-color: white; 107 | color: white; 108 | } 109 | 110 | .btn-ember { 111 | &.btn-outline { 112 | color: var(--redColor); 113 | border-color: var(--redColor); 114 | 115 | &:hover { 116 | color: var(--orangeColor); 117 | border-color: var(--orangeColor); 118 | } 119 | } 120 | } 121 | 122 | #footer { 123 | background: #fff; 124 | padding: 25px 0; 125 | color: #555; 126 | 127 | .content { 128 | display: flex; 129 | justify-content: space-between; 130 | align-items: center; 131 | } 132 | 133 | .copyright { 134 | font-size: 13px; 135 | margin-bottom: 0; 136 | 137 | img { 138 | width: 24px; 139 | vertical-align: bottom; 140 | } 141 | 142 | a { 143 | color: black; 144 | font-weight: bold; 145 | 146 | &:hover { 147 | color: var(--redColor); 148 | } 149 | } 150 | } 151 | 152 | .social { 153 | text-align: right; 154 | margin-bottom: 0; 155 | padding-left: 0; 156 | display: flex; 157 | justify-content: space-between; 158 | width: 80px; 159 | 160 | li { 161 | display: inline-block; 162 | 163 | a { 164 | font-size: 22px; 165 | color: black; 166 | 167 | &:hover { 168 | color: var(--redColor); 169 | } 170 | } 171 | } 172 | } 173 | } 174 | 175 | .gitter-chat-embed { 176 | margin-top: 70px; 177 | } 178 | 179 | .gitter-open-chat-button { 180 | background-color: var(--redColor); 181 | bottom: 200px; 182 | right: -55px; 183 | transform: rotate(-90deg); 184 | 185 | &:hover,&:focus { 186 | background-color: var(--orangeColor); 187 | } 188 | 189 | &.is-collapsed { 190 | transform: rotate(-90deg); 191 | right: -95px; 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Ember Rollbar Client Logo 3 | 4 | 5 | Dependency Status 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Gitter 14 | 15 |

16 | 17 | ___ 18 | The Rollbar client for EmberJS applications. 19 | > This one just works! 20 | 21 | - Automatic logger for: 22 | - `js window` errors 23 | - `ember` errors 24 | - No `Bower` dependency 25 | - Fastboot compatible 26 | - Practical wrapper with access to pure `Rollbar` 27 | - Compatible with Ember 3.8 and up 28 | 29 | ## Compatibility 30 | 31 | * Ember.js v3.8 or above 32 | * Ember CLI v2.13 or above 33 | * Node.js v10 or above 34 | 35 | ## Installation 36 | 37 | 1. `ember install ember-rollbar-client` 38 | 2. Add your `accessToken` in `config/environment.js` 39 | ```js 40 | module.exports = function(environment) { 41 | var ENV = { 42 | emberRollbarClient: { 43 | accessToken: 'rollbar-write-client-token', 44 | // By default Rollbar logging is enabled in every environment except test and development. 45 | // Here is an example if you want to use it only in production 46 | enabled: environment === 'production' 47 | } 48 | }; 49 | 50 | return ENV; 51 | } 52 | ``` 53 | 54 | ## Usage 55 | 56 | ### Rollbar Service 57 | In your component, controller, route, object (or whatever) you can inject the `rollbar` service, eg: 58 | 59 | ```js 60 | import Ember from 'ember'; 61 | const { Component, inject } = Ember; 62 | 63 | export default Component.extend({ 64 | rollbar: inject.service() 65 | }); 66 | ``` 67 | 68 | And then you can use following API to log errors: 69 | ```js 70 | this.get('rollbar').critical(message, data = {}) 71 | this.get('rollbar').error(message, data = {}) 72 | this.get('rollbar').warning(message, data = {}) 73 | this.get('rollbar').info(message, data = {}) 74 | this.get('rollbar').debug(message, data = {}) 75 | ``` 76 | 77 | ### Set current user 78 | To set current user use just a normal setter in your session service: 79 | 80 | ```js 81 | this.set('rollbar.currentUser', { email: 'user@email.com', id: 66 }) 82 | ``` 83 | 84 | ### Access current notifier 85 | If you can not find in our API a proper wrapper, you can always use the current Rollbar instance: 86 | ```js 87 | this.get('rollbar.notifier') 88 | ``` 89 | 90 | ### Support error handling from RSVP 91 | Create the following instance initializer in your app: 92 | 93 | ```js 94 | // app/instance-initializer/rsvp-error-handler.js 95 | import RSVP from "rsvp"; 96 | 97 | export function initialize(appInstance) { 98 | let rollbarService = appInstance.lookup('service:rollbar'); 99 | 100 | RSVP.on('error', function(reason) { 101 | rollbarService.error(reason); 102 | }); 103 | } 104 | 105 | export default { 106 | name: 'rsvp-error-handler', 107 | initialize 108 | }; 109 | ``` 110 | 111 | ### Create new Rollbar instance 112 | You can use `rollbarClient` function of the `Rollbar Service` to create a new instance of Rollbar notifier. Optionally you can pass your own config. 113 | 114 | ```js 115 | this.get('rollbar').rollbarClient(/* config */) 116 | ``` 117 | 118 | ### Support code_version on Heroku build 119 | Add at the bottom of your `config/environment.js` file: 120 | ```js 121 | // Heroku Git Hash support 122 | if (process.env.SOURCE_VERSION) { 123 | let packageJson = require('../package.json'); 124 | let gitHash = process.env.SOURCE_VERSION.substr(0, 7); 125 | ENV.emberRollbarClient.payload.client.javascript['code_version'] = `${packageJson.version}+${gitHash}`; 126 | } 127 | ``` 128 | 129 | ### Configuration 130 | You can overwrite Rollbar configuration in environment's config. Here is the default config: 131 | 132 | ``` js 133 | 'emberRollbarClient': { 134 | enabled: environment !== 'test' && environment !== 'development', 135 | accessToken: '', 136 | verbose: true, 137 | captureUncaught: environment !== 'test', 138 | captureUnhandledRejections: environment !== 'test', 139 | payload: { 140 | environment: environment, 141 | client: { 142 | javascript: { 143 | source_map_enabled: true, 144 | guess_uncaught_frames: true 145 | code_version: "YOUR_APP_VERSION" // returns app version in format: 2.4.0+06df23a 146 | // leave empty to use application version which is a default value 147 | } 148 | } 149 | } 150 | }; 151 | ``` 152 | 153 | ## Contributing 154 | 155 | See the [Contributing](CONTRIBUTING.md) guide for details. 156 | 157 | 158 | ## License 159 | 160 | This project is licensed under the [MIT License](LICENSE.md). 161 | --------------------------------------------------------------------------------