-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ssl) improve error messages to log original error #595
Conversation
a2051c1
to
f0486aa
Compare
extensions/nginx/acme.js
Outdated
return Promise.reject(new cli.errors.SystemError( | ||
'Your domain name is not pointing to the correct IP address of your server, please update it and run `ghost setup ssl` again' | ||
)); | ||
return Promise.reject(new cli.errors.SystemError({ |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -27,10 +27,6 @@ function install(ui, task) { | |||
ui.logVerbose('ssl: downloading acme.sh to temporary directory', 'green'); | |||
return fs.emptyDir(acmeTmpDir) | |||
}).then(() => got(acmeApiUrl)).then((response) => { | |||
if (response.statusCode !== 200) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
lib/errors.js
Outdated
@@ -23,7 +23,10 @@ class CliError extends Error { | |||
Error.captureStackTrace(this, this.constructor); | |||
|
|||
this.context = options.context || {}; | |||
// TODO: Do something with the original error message which we can receive now as the `err` property | |||
this.err = options.err || {}; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
0cc6821
to
83da6b2
Compare
@@ -83,11 +114,16 @@ class ProcessError extends CliError { | |||
output += chalk.yellow(`Exit code: ${this.options.code}\n\n`); | |||
} | |||
|
|||
if (verbose && this.options.stdout) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
83da6b2
to
597f67d
Compare
597f67d
to
154c4c3
Compare
@kirrg001 @acburdine I think this one is ready for review! |
@@ -10,6 +10,8 @@ const chalk = require('chalk'); | |||
*/ | |||
class CliError extends Error { | |||
constructor(options) { | |||
const originalError = {}; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from a code standpoint 👍
@acburdine Thanks for code review. I'll test that PR later 👍 |
lib/utils/resolve-version.js
Outdated
@@ -53,7 +53,8 @@ module.exports = function resolveVersion(version, update) { | |||
} catch (e) { | |||
return Promise.reject(new errors.CliError({ | |||
message: 'Ghost-CLI was unable to load versions from Yarn.', | |||
log: false | |||
log: false, | |||
err: e |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
refs TryGhost#587 - fixes an issue, where failed requests with `got` wouldn't get catched properly - differentiates between `ProcessError` for `stderr` and `CliError` for everything else - `CliError` can be passed the original error and will log the `message` and `stack` to the log file, or log in the UI when in verbose mode - Adds `err` property with original error whereever we have it so it'll be passed along and printed in the log file
154c4c3
to
aecb1c9
Compare
refs #587
got
wouldn't get catched properlyProcessError
forstderr
andCliError
for everything elseCliError
can be passed the original error and will log themessage
andstack
to the log file, or log in the UI when in verbose modeerr
property with original error whereever we have it so it'll be passed along and printed in the log file