@cryptotaxi247 / kubo / commits / 5e16dfb11

commands: Improved option conversin error message

Matt Bell committed Nov 16, 2014 at 18:05 UTC 5e16dfb111935400a384186a74079be1971cc095
1 file changed +6 -2
commands/request.go
+6 -2
@@ -223,8 +223,12 @@ func (r *request) ConvertOptions() error {
223 }
224 val, err := convert(str)
225 if err != nil {
226 - return fmt.Errorf("Could not convert string value '%s' to type '%s'",
227 - v, opt.Type.String())
226 + value := fmt.Sprintf("value '%v'", v)
227 + if len(str) == 0 {
228 + value = "empty value"
229 + }
230 + return fmt.Errorf("Could not convert %s to type '%s' (for option '-%s')",
231 + value, opt.Type.String(), k)
232 }
233 r.options[k] = val
234