handle request errors with redirects; closes #119
This commit is contained in:
parent
c86affcb73
commit
1f339070e9
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "burnchart",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"description": "GitHub Burndown Chart as a Service",
|
||||
"author": "Radek Stepan <dev@radekstepan.com> (http://radekstepan.com)",
|
||||
"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
|
@ -17,7 +17,7 @@ superagent.parse = {
|
|||
};
|
||||
|
||||
// Default args.
|
||||
let defaults = {
|
||||
const defaults = {
|
||||
'github': {
|
||||
'host': 'api.github.com',
|
||||
'protocol': 'https'
|
||||
|
@ -128,7 +128,7 @@ let request = ({ protocol, host, path, query, headers }, cb) => {
|
|||
|
||||
// How do we respond to a response?
|
||||
let response = (err, data, cb) => {
|
||||
if (err) return cb(error(data.body || err));
|
||||
if (err) return cb(error(data ? data.body : err));
|
||||
// 2xx?
|
||||
if (data.statusType !== 2) return cb(error(data.body));
|
||||
// All good.
|
||||
|
|
|
@ -112,7 +112,7 @@ class ProjectsStore extends Store {
|
|||
onProjectsDemo() {
|
||||
this.set({
|
||||
'list': [
|
||||
{ 'owner': 'mbostock', 'name': 'd3' },
|
||||
{ 'owner': 'd3', 'name': 'd3' },
|
||||
{ 'owner': 'radekstepan', 'name': 'disposable' },
|
||||
{ 'owner': 'rails', 'name': 'rails' }
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue