Browse code

Fix Error Check in NewNetwork

Use types.MaskableError instead of doing a string comparison

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>

Arko Dasgupta authored on 2019/10/03 16:54:45
Showing 1 changed files
... ...
@@ -825,7 +825,7 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ...
825 825
 
826 826
 	err = c.addNetwork(network)
827 827
 	if err != nil {
828
-		if strings.Contains(err.Error(), "restoring existing network") {
828
+		if _, ok := err.(types.MaskableError); ok {
829 829
 			// This error can be ignored and set this boolean
830 830
 			// value to skip a refcount increment for configOnly networks
831 831
 			skipCfgEpCount = true