get-connpass-items
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -15,3 +15,4 @@ 'use strict'; | ||
var instance = axios.create({ | ||
baseURL: 'https://connpass.com/api/v1/' | ||
baseURL: 'https://connpass.com/api/v1/', | ||
timeout: 30000 | ||
}); | ||
@@ -35,7 +36,8 @@ | ||
}).then(function (res) { | ||
spinner.stop(); | ||
console.log('\n'); | ||
res.data.events.forEach(function (item) { | ||
console.log(boxen('\n title: ' + item.title + ' \n url: ' + item.event_url + ' \n date: ' + item.updated_at + '\n ', { borderColor: 'cyan' })); | ||
}); | ||
}).then(function () { | ||
spinner.stop(); | ||
}).catch(function (err) { | ||
@@ -45,9 +47,13 @@ spinner.stop(); | ||
if (err.config.timeout === 30000) { | ||
console.log(boxen(' Request timeout ;( \n Please try again.', { borderColor: 'red' })); | ||
return; | ||
} | ||
switch (err.response.status) { | ||
case 502: | ||
console.log(boxen(' Now on maintenance ', { borderColor: 'red' })); | ||
console.log(boxen(' Now on maintenance ;( ', { borderColor: 'red' })); | ||
break; | ||
case 504: | ||
default: | ||
console.log(boxen(' Internal Server Error ', { borderColor: 'red' })); | ||
console.log(boxen(' Internal Server Error ;( ', { borderColor: 'red' })); | ||
break; | ||
@@ -54,0 +60,0 @@ } |
{ | ||
"name": "get-connpass-items", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "get-connpass-items(csm) is a CLI application.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -43,11 +43,26 @@ [](https://badge.fury.io/js/get-connpass-items) | ||
note: If it takes more than `5000ms` it will time out. | ||
note: If it takes more than `30s` it will time out. | ||
``` | ||
┌────────────────────────┐ | ||
│ Request timeout ;( │ | ||
│ Please try again. │ | ||
└────────────────────────┘ | ||
┌───────────────────────────┐ | ||
│ Now on maintenance ;( │ | ||
└───────────────────────────┘ | ||
``` | ||
note: If connpass is undergoing maintenance, | ||
``` | ||
┌───────────────────────────┐ | ||
│ Now on maintenance ;( │ | ||
└───────────────────────────┘ | ||
``` | ||
note: If some error occurs, | ||
``` | ||
┌──────────────────────────────┐ | ||
│ Internal Server Error ;( │ | ||
└──────────────────────────────┘ | ||
``` | ||
## License | ||
@@ -54,0 +69,0 @@ |
@@ -13,3 +13,4 @@ const yargs = require('yargs') | ||
const instance = axios.create({ | ||
baseURL: 'https://connpass.com/api/v1/' | ||
baseURL: 'https://connpass.com/api/v1/', | ||
timeout: 30000 | ||
}) | ||
@@ -35,2 +36,5 @@ | ||
.then((res) => { | ||
spinner.stop() | ||
console.log('\n') | ||
res.data.events.forEach((item) => { | ||
@@ -45,5 +49,2 @@ console.log(boxen(` | ||
}) | ||
.then(() => { | ||
spinner.stop() | ||
}) | ||
.catch((err) => { | ||
@@ -53,9 +54,13 @@ spinner.stop() | ||
if (err.config.timeout === 30000) { | ||
console.log(boxen(' Request timeout ;( \n Please try again.', { borderColor: 'red' })) | ||
return | ||
} | ||
switch (err.response.status) { | ||
case 502: | ||
console.log(boxen(' Now on maintenance ', { borderColor: 'red' })) | ||
console.log(boxen(' Now on maintenance ;( ', { borderColor: 'red' })) | ||
break | ||
case 504: | ||
default: | ||
console.log(boxen(' Internal Server Error ', { borderColor: 'red' })) | ||
console.log(boxen(' Internal Server Error ;( ', { borderColor: 'red' })) | ||
break | ||
@@ -62,0 +67,0 @@ } |
12588
228
73