Skip to content
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

support/log: add log fatal functions #989

Merged
merged 4 commits into from
Mar 11, 2019
Merged

Conversation

howardtw
Copy link
Contributor

@howardtw howardtw commented Mar 8, 2019

We've been using log.Panic for initialization. Panic should be used on
unexpected things. In our case, it is likely that the user doesn't have
the right configs to spin up our server.

We've been using `log.Panic` for initialization. Panic should be used on
unexpected things. In our case, it is likely that the user doesn't have
the right configs to spin up our server.
@howardtw howardtw self-assigned this Mar 8, 2019
@ire-and-curses ire-and-curses self-requested a review March 11, 2019 17:56
Copy link
Member

@ire-and-curses ire-and-curses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just a small suggestion

session, err := db.Open("postgres", app.config.DatabaseURL)
if err != nil {
log.Panic(err)
log.Fatalf("cannot open Horizon DB due to error %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Message might be better as "cannot open Horizon DB: %v", err (this is how the errors.wrap module does it)

session, err := db.Open("postgres", app.config.StellarCoreDatabaseURL)
if err != nil {
log.Panic(err)
log.Fatalf("cannot open core DB due to error %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

@howardtw howardtw merged commit 0887537 into stellar:master Mar 11, 2019
@howardtw howardtw deleted the db-init branch March 13, 2019 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants