print cloudron info if box creation failed
This commit is contained in:
parent
737b0dc43c
commit
5e679a256f
@ -74,7 +74,7 @@ AppStore.prototype.waitForCloudron = function (boxId) {
|
|||||||
AppStore.prototype.createCloudron = function (box) {
|
AppStore.prototype.createCloudron = function (box) {
|
||||||
var accessToken = this._credentials.accessToken;
|
var accessToken = this._credentials.accessToken;
|
||||||
var res = request.post(this._origin + '/api/v1/cloudrons').send(box).query({ accessToken: accessToken }).end();
|
var res = request.post(this._origin + '/api/v1/cloudrons').send(box).query({ accessToken: accessToken }).end();
|
||||||
common.verifyResponse(res, 'Could not create cloudron');
|
common.verifyResponse(res, 'Could not create cloudron %j', box);
|
||||||
|
|
||||||
debug('Cloudron %s created'.green, box.domain);
|
debug('Cloudron %s created'.green, box.domain);
|
||||||
return res.body.box;
|
return res.body.box;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
var path = require('path'),
|
var path = require('path'),
|
||||||
safe = require('safetydance'),
|
safe = require('safetydance'),
|
||||||
|
util = require('util'),
|
||||||
_ = require('underscore');
|
_ = require('underscore');
|
||||||
|
|
||||||
exports = module.exports = {
|
exports = module.exports = {
|
||||||
@ -37,18 +38,20 @@ function stripUnreachable(releases) {
|
|||||||
return _.pick(releases, reachableVersions);
|
return _.pick(releases, reachableVersions);
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyResponse2(res, errorMessage) {
|
function verifyResponse2(res, args) {
|
||||||
if (res.statusCode < 200 || res.statusCode > 399) {
|
if (res.statusCode < 200 || res.statusCode > 399) {
|
||||||
debug('Response error statusCode:%s error:%s body:%j', res.statusCode, res.error, res.body);
|
debug('Response error statusCode:%s error:%s body:%j', res.statusCode, res.error, res.body);
|
||||||
|
var errorMessage = util.format.apply(util, Array.prototype.slice.call(arguments, 1));
|
||||||
debug(errorMessage.red);
|
debug(errorMessage.red);
|
||||||
throw new Error(errorMessage);
|
throw new Error(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyResponse(res, errorMessage) {
|
function verifyResponse(res, args) {
|
||||||
if (res.statusCode < 200 || res.statusCode > 299) {
|
if (res.statusCode < 200 || res.statusCode > 299) {
|
||||||
console.log('Response error statusCode:%s error:%s body:%j', res.statusCode, res.error, res.body);
|
console.log('Response error statusCode:%s error:%s body:%j', res.statusCode, res.error, res.body);
|
||||||
console.log(errorMessage.red);
|
var errorMessage = util.format.apply(util, Array.prototype.slice.call(arguments, 1));
|
||||||
|
debug(errorMessage.red);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user