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

Panic when attempting to configure invalid cache #93

Merged
merged 1 commit into from
Oct 29, 2018
Merged

Panic when attempting to configure invalid cache #93

merged 1 commit into from
Oct 29, 2018

Conversation

SuperQ
Copy link
Collaborator

@SuperQ SuperQ commented Oct 25, 2018

Instead of defaulting to cache type memory when misconfigured, panic.

Signed-off-by: Ben Kochie [email protected]

Looks like this:

$ trickster -conf invalid.conf
time=2018-10-25T12:19:25.109494354Z app=trickster caller=trickster/main.go:63 level=info event="application startup" version=0.1.1
time=2018-10-25T12:19:25.109628973Z app=trickster caller=trickster/metrics.go:47 level=info event="metrics http endpoint starting" address= port=8082
panic: Invalid cache type: "boom"

goroutine 1 [running]:
main.getCache(0xc000032580, 0xc00000e0d0, 0xc00000e0d8)
	/home/ben/go/src/github.com/comcast/trickster/cache.go:49 +0x3c5
main.main()
	/home/ben/go/src/github.com/comcast/trickster/main.go:68 +0x32a

Instead of defaulting to cache type memory when misconfigured, panic.

Signed-off-by: Ben Kochie <[email protected]>
@juliusv
Copy link
Collaborator

juliusv commented Oct 25, 2018

Ok as a short-term fix, but it'd be much better to exit cleanly with an error rather than outright panic-ing.

@SuperQ
Copy link
Collaborator Author

SuperQ commented Oct 25, 2018

Yes, a clean exit would be better.

@jranson jranson merged commit 202c393 into trickstercache:master Oct 29, 2018
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.

4 participants