-
Notifications
You must be signed in to change notification settings - Fork 38
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
fail if an error log has occured #41
Conversation
cmd/klotho/main.go
Outdated
@@ -83,11 +84,7 @@ func main() { | |||
|
|||
err := root.Execute() | |||
if err != nil { | |||
if cfg.internalDebug { |
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.
i was confused on why we have this. just reprints errors it looks like so i removed it. If theres a reason to have it ill add it back and have to change my implementation
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.
The difference is in the format: %+v
vs %v
. The +
gives a full stack trace, which is only relevant for us developers and not for users.
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.
so do we want to have it as a cli flag then? because this could be exposed to the end user right?
cmd/klotho/main.go
Outdated
analyticsClient.Error("klotho compiling failed") | ||
|
||
cmd.SilenceErrors = true | ||
cmd.SilenceUsage = true | ||
return err | ||
return errors.New("Failed run of klotho invocation") |
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.
because we always set SilenceErrors to true it shouldnt matter what we return, just that we return some error
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.
The main parts look good, just comments on the extra changes included.
cmd/klotho/main.go
Outdated
@@ -83,11 +84,7 @@ func main() { | |||
|
|||
err := root.Execute() | |||
if err != nil { | |||
if cfg.internalDebug { |
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.
The difference is in the format: %+v
vs %v
. The +
gives a full stack trace, which is only relevant for us developers and not for users.
@@ -83,11 +84,7 @@ func main() { | |||
|
|||
err := root.Execute() | |||
if err != nil { | |||
if cfg.internalDebug { | |||
zap.S().Errorf("%+v", err) | |||
} else if !root.SilenceErrors { |
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.
Doesn't this regress the silence errors (which we set on line 270 so it doesn't double-print)?
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.
nope, we still set that to make sure that we dont double print anything
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.
yeah we actually will want this so that the non plugin errors surface, going to add it back
if err != nil { | ||
errHandler.PrintErr(err) | ||
} else { | ||
err = errors.New("Failed run of klotho invocation") |
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.
I feel like this should go similar to the hadWarnings check (line 94)
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.
that results in a double print as well though since we already log it. i think if we are treating error log lines and errors the same, having them go through the same flow is fine, it then treats zap errors as actual errors
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.
we would also still print the output then if we did it that way which i thought this task is trying to prevent
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.
True, we do want to prevent writing the output. I guess this error wouldn't get printed since we don't explicitly print it (like we do for err != nil
) and also set SilenceErrors. 👍
|
if err != nil { | ||
errHandler.PrintErr(err) | ||
} else { | ||
err = errors.New("Failed run of klotho invocation") |
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.
True, we do want to prevent writing the output. I guess this error wouldn't get printed since we don't explicitly print it (like we do for err != nil
) and also set SilenceErrors. 👍
• Does any part of it require special attention?
• Does it relate to or fix any issue? closes #297
making compilation fail if an error is logged. Making consistent message at the end of the failure as well
case for logging an error
case for an error being returned
Standard checks