diff --git a/commands/command.go b/commands/command.go
index 5e031338e12117abbec95ea863bbd5f7a87592b8..383e9f217f5003314396b69c0109e1ade440583b 100644
--- a/commands/command.go
+++ b/commands/command.go
@@ -103,11 +103,12 @@ func (c *Command) Call(req Request) Response {
 	if err != nil {
 		// if returned error is a commands.Error, use its error code
 		// otherwise, just default the code to ErrNormal
-		var e Error
-		e, ok := err.(Error)
-		if ok {
+		switch e := err.(type) {
+		case *Error:
 			res.SetError(e, e.Code)
-		} else {
+		case Error:
+			res.SetError(e, e.Code)
+		default:
 			res.SetError(err, ErrNormal)
 		}
 		return res