diff --git a/lib/config.js b/lib/config.js index 55e7092..719d4a5 100755 --- a/lib/config.js +++ b/lib/config.js @@ -12,7 +12,7 @@ var sprintf = require('extsprintf').sprintf; var common = require('./common'); -var CONFIG_PATH = path.resolve(process.env.HOME, '.joyentcloudconfig.json'); +var CONFIG_PATH = path.resolve(process.env.HOME, '.sdcconfig.json'); var DEFAULTS_PATH = path.resolve(__dirname, '..', 'etc', 'defaults.json'); @@ -29,7 +29,7 @@ function loadConfigSync() { } config.profiles.push({ name: 'env', - account: process.env.SDC_USER || process.env.SDC_ACCOUNT, + user: process.env.SDC_USER || process.env.SDC_ACCOUNT, keyId: process.env.SDC_KEY_ID, rejectUnauthorized: common.boolFromString( process.env.SDC_TESTING || process.env.SDC_TLS_INSECURE) diff --git a/lib/errors.js b/lib/errors.js index 786b365..40ab66e 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -19,7 +19,7 @@ var verror = require('verror'), * Base error. Instances will always have a string `message` and * a string `code` (a CamelCase string). */ -function JoyentError(options) { +function SDCError(options) { assert.object(options, 'options'); assert.string(options.message, 'options.message'); assert.string(options.code, 'options.code'); @@ -38,7 +38,7 @@ function JoyentError(options) { self[k] = options[k]; }); } -util.inherits(JoyentError, VError); +util.inherits(SDCError, VError); function InternalError(cause, message) { if (message === undefined) { @@ -46,29 +46,47 @@ function InternalError(cause, message) { cause = undefined; } assert.string(message); - JoyentError.call(this, { + SDCError.call(this, { cause: cause, message: message, code: 'InternalError', exitStatus: 1 }); } -util.inherits(InternalError, JoyentError); +util.inherits(InternalError, SDCError); + +/** + * CLI usage error + */ function UsageError(cause, message) { if (message === undefined) { message = cause; cause = undefined; } assert.string(message); - JoyentError.call(this, { + SDCError.call(this, { cause: cause, message: message, code: 'Usage', exitStatus: 1 }); } -util.inherits(UsageError, JoyentError); +util.inherits(UsageError, SDCError); + + +/** + * An error signing a request. + */ +function SigningError(cause) { + SDCError.call(this, { + cause: cause, + message: 'error signing request', + code: 'Signing', + exitStatus: 1 + }); +} +util.inherits(SigningError, SDCError); /** @@ -81,7 +99,7 @@ function MultiError(errs) { var err = errs[i]; lines.push(format(' error (%s): %s', err.code, err.message)); } - JoyentError.call(this, { + SDCError.call(this, { cause: errs[0], message: lines.join('\n'), code: 'MultiError', @@ -89,16 +107,17 @@ function MultiError(errs) { }); } MultiError.description = 'Multiple errors.'; -util.inherits(MultiError, JoyentError); +util.inherits(MultiError, SDCError); // ---- exports module.exports = { - JoyentError: JoyentError, + SDCError: SDCError, InternalError: InternalError, UsageError: UsageError, + SigningError: SigningError, MultiError: MultiError }; // vim: set softtabstop=4 shiftwidth=4: