topiary-io / topiary

a modern content management system
Other
2 stars 0 forks source link

Intelligent error handling and logging #12

Open doesntgolf opened 8 years ago

doesntgolf commented 8 years ago

We currently have some very basic logging and error handling. I know there's at least one spot where we're just throwing errors away though. Also, the main spot that I have in mind is handling exec.Command("hugo") better.

I tried briefly to add error handling to this when I was working on #2 but quickly broke everything and decided to skip it (sorry for not logging what I did better). If Hugo doesn't build correctly we shouldn't continue, we should stop and throw a helpful error instead of serving the wrong content.

Eventually, it'd also be cool to be able to have the topiary command run from anywhere in the Hugo site file tree and be able to figure it out and work correctly. And if topiary is run where there isn't a Hugo site, we should offer to start one or find an existing one on disk (in the browser UI). (This should be part of the flow that will be created in #4.)

jbeane commented 8 years ago

exec.Command("hugo") is a little better now, but not great. see lines 13-19: commit

now exec.Command("hugo") is wrapped in some error handling and here's what is output by log.Fatal(err) when trying to run topiary in a directory without a hugo site installed.

2016/01/24 22:24:04 exit status 255