Move no arguments check to before opening fsrepo.
License: MIT Signed-off-by: Yuval Langer <yuval.langer@gmail.com>
Yuval Langer committed
Jun 21, 2016 at 00:41 UTC
20b649910214c927940b88565ade7f73b7ae64a3
1 file changed
+5
-5
core/commands/swarm.go
+5
-5
@@ -461,6 +461,11 @@ add your filters to the ipfs config file.
461
return
462
}
463
464
+ if len(req.Arguments()) == 0 {
465
+ res.SetError(errors.New("no filters to add"), cmds.ErrClient)
466
+ return
467
+ }
468
+
469
r, err := fsrepo.Open(req.InvocContext().ConfigRoot)
470
if err != nil {
471
res.SetError(err, cmds.ErrNormal)
@@ -473,11 +478,6 @@ add your filters to the ipfs config file.
478
return
479
}
480
476
- if len(req.Arguments()) == 0 {
477
- res.SetError(errors.New("no filters to add"), cmds.ErrClient)
478
- return
479
- }
480
-
481
for _, arg := range req.Arguments() {
482
mask, err := mafilter.NewMask(arg)
483
if err != nil {