The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5552

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From bb0a66877a8c50af2492b10c0711f1a0568850ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 6 Mar 2019 16:43:05 -0500
Subject: [PATCH] lxd/response: Simplify SmartError
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/response.go | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lxd/response.go b/lxd/response.go
index 62bcc9669f..b78ab96544 100644
--- a/lxd/response.go
+++ b/lxd/response.go
@@ -521,17 +521,11 @@ func SmartError(err error) Response {
        switch errors.Cause(err) {
        case nil:
                return EmptySyncResponse
-       case os.ErrNotExist:
-               return NotFound(nil)
-       case sql.ErrNoRows:
-               return NotFound(nil)
-       case db.ErrNoSuchObject:
+       case os.ErrNotExist, sql.ErrNoRows, db.ErrNoSuchObject:
                return NotFound(nil)
        case os.ErrPermission:
                return Forbidden(nil)
-       case db.ErrAlreadyDefined:
-               return Conflict(nil)
-       case sqlite3.ErrConstraintUnique:
+       case db.ErrAlreadyDefined, sqlite3.ErrConstraintUnique:
                return Conflict(nil)
        case dqlite.ErrNoAvailableLeader:
                return Unavailable(err)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to