File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ func ParsePort(rawPort string) (int, error) {
4949 }
5050 port , err := strconv .ParseUint (rawPort , 10 , 16 )
5151 if err != nil {
52- return 0 , err
52+ return 0 , fmt . Errorf ( "invalid port '%s': %w" , rawPort , errors . Unwrap ( err ))
5353 }
5454 return int (port ), nil
5555}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ func TestParsePort(t *testing.T) {
1616 doc : "invalid value" ,
1717 input : "asdf" ,
1818 expPort : 0 ,
19- expErr : `strconv.ParseUint: parsing " asdf" : invalid syntax` ,
19+ expErr : `invalid port ' asdf' : invalid syntax` ,
2020 },
2121 {
2222 doc : "empty value" ,
@@ -32,7 +32,7 @@ func TestParsePort(t *testing.T) {
3232 doc : "negative value" ,
3333 input : "-1" ,
3434 expPort : 0 ,
35- expErr : `strconv.ParseUint: parsing "-1" : invalid syntax` ,
35+ expErr : `invalid port '-1' : invalid syntax` ,
3636 },
3737 // FIXME currently this is a valid port. I don't think it should be.
3838 // I'm leaving this test commented out until we make a decision.
@@ -52,7 +52,7 @@ func TestParsePort(t *testing.T) {
5252 doc : "value out of range" ,
5353 input : "65536" ,
5454 expPort : 0 ,
55- expErr : `strconv.ParseUint: parsing " 65536" : value out of range` ,
55+ expErr : `invalid port ' 65536' : value out of range` ,
5656 },
5757 }
5858
You can’t perform that action at this time.
0 commit comments