mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
Remove panic() and handle it appropriately (#5807)
This is an effort to remove panic from the source. Add a new call called CriticialIf, that calls LogIf and exits. Replace panics with one of CriticalIf, FatalIf and a return of error.
This commit is contained in:
@@ -71,22 +71,3 @@ func TestParsePort(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMustParsePort(t *testing.T) {
|
||||
testCases := []struct {
|
||||
s string
|
||||
expectedPort Port
|
||||
}{
|
||||
{"0", Port(0)},
|
||||
{"9000", Port(9000)},
|
||||
{"65535", Port(65535)},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
port := MustParsePort(testCase.s)
|
||||
|
||||
if port != testCase.expectedPort {
|
||||
t.Fatalf("test %v: error: port: %v, got: %v", i+1, testCase.expectedPort, port)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user