Sioro-Neoku / go-peerflix

Go Peerflix
MIT License
470 stars 119 forks source link

include context in fatal errors #1

Closed KevinPike closed 8 years ago

KevinPike commented 8 years ago

This includes context in fatal errors logged to help diagnose the errors.

I encountered a confusing error when running go-peerflix.

> ./go-peerflix -seed false 'magnet:?xt=urn:btih:KRWPCX3SJUM4IMM4YF5RPHL6ANPYTQPU'
2015/10/10 12:24:49 unexpected scheme: ""

This happened because I needed to use -seed=false and -seed false was causing the magent url to be false. I think it could be helpful to include the context of the call which resulted in a fatal error. Now, this error would be:

> ./go-peerflix -seed false 'magnet:?xt=urn:btih:KRWPCX3SJUM4IMM4YF5RPHL6ANPYTQPU'
2015/10/10 12:24:49 Error adding magnet "false": unexpected scheme: ""
Sioro-Neoku commented 8 years ago

Sounds great, thank you!