handle request errors with redirects; closes #119

This commit is contained in:
Radek Stepan 2016-06-08 09:56:51 -04:00
parent c86affcb73
commit 1f339070e9
5 changed files with 14 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "burnchart", "name": "burnchart",
"version": "3.1.0", "version": "3.1.1",
"description": "GitHub Burndown Chart as a Service", "description": "GitHub Burndown Chart as a Service",
"author": "Radek Stepan <dev@radekstepan.com> (http://radekstepan.com)", "author": "Radek Stepan <dev@radekstepan.com> (http://radekstepan.com)",
"license": "AGPL-3.0", "license": "AGPL-3.0",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ superagent.parse = {
}; };
// Default args. // Default args.
let defaults = { const defaults = {
'github': { 'github': {
'host': 'api.github.com', 'host': 'api.github.com',
'protocol': 'https' 'protocol': 'https'
@ -128,7 +128,7 @@ let request = ({ protocol, host, path, query, headers }, cb) => {
// How do we respond to a response? // How do we respond to a response?
let response = (err, data, cb) => { let response = (err, data, cb) => {
if (err) return cb(error(data.body || err)); if (err) return cb(error(data ? data.body : err));
// 2xx? // 2xx?
if (data.statusType !== 2) return cb(error(data.body)); if (data.statusType !== 2) return cb(error(data.body));
// All good. // All good.

View File

@ -112,7 +112,7 @@ class ProjectsStore extends Store {
onProjectsDemo() { onProjectsDemo() {
this.set({ this.set({
'list': [ 'list': [
{ 'owner': 'mbostock', 'name': 'd3' }, { 'owner': 'd3', 'name': 'd3' },
{ 'owner': 'radekstepan', 'name': 'disposable' }, { 'owner': 'radekstepan', 'name': 'disposable' },
{ 'owner': 'rails', 'name': 'rails' } { 'owner': 'rails', 'name': 'rails' }
], ],