Skip to contentSkip to conversation

vnc: Fix QMP change not to use funky error class

PATCH In review Markus Armbruster 6 participants 8 messages Mar 13, 2015 – Mar 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vnc: Fix QMP change not to use funky error class

Error classes are a leftover from the days of "rich" error objects. New code should always use ERROR_CLASS_GENERIC_ERROR. Commit 1d0d59f added a use of ERROR_CLASS_DEVICE_NOT_FOUND. Replace it.

---
 ui/vnc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/vnc.c +1 -1
index 6f9b718..a950016 100644
@@ -3594,7 +3594,7 @@ void vnc_display_open(const char *id, Error **errp)
 
         dev = qdev_find_recursive(sysbus_get_default(), device_id);
         if (dev == NULL) {
-            error_set(errp, QERR_DEVICE_NOT_FOUND, device_id);
+            error_setg(errp, "Device '%s' not found", device_id);
             goto fail;
         }
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 3 lines · Markus Armbruster

Error classes are a leftover from the days of "rich" error objects. New code should always use ERROR_CLASS_GENERIC_ERROR. Commit 1d0d59f added a use of ERROR_CLASS_DEVICE_NOT_FOUND. Replace it.

Quoted 15 lines
 ui/vnc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/vnc.c +1 -1
index 6f9b718..a950016 100644
@@ -3594,7 +3594,7 @@ void vnc_display_open(const char *id, Error **errp)
 
         dev = qdev_find_recursive(sysbus_get_default(), device_id);
         if (dev == NULL) {
-            error_set(errp, QERR_DEVICE_NOT_FOUND, device_id);
+            error_setg(errp, "Device '%s' not found", device_id);
             goto fail;
         }
#3 lore raw
In reply to Markus Armbruster

This series passed Patchew automatic testing, but there are some warnings.

Find the log fragments below, or open the following URL to see the full log:

http://qemu.patchew.org/testing/log/<[email protected]>

----------8<---------

=== Starting docker ===

Copying test script "/home/patchew/tests/qemu-devel.sh"
Starting docker...
docker run --net=none -v /var/tmp/patchew-tester/tmpy9kx15:/var/tmp/patchew-test patchew:fedora-20 timeout 3600 /var/tmp/patchew-test/qemu-devel.sh /var/tmp/patchew-test

*** Testing 'coding style check' ***

Checking 0001-vnc--Fix-QMP-change-not-to-use-funky-error-class.patch command failed with exit code 0
$@
ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 8 lines checked

0001-vnc--Fix-QMP-change-not-to-use-funky-error-class.patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

*** Testing 'configure' ***

Install prefix    /usr/local
BIOS directory    /usr/local/share/qemu
binary directory  /usr/local/bin

library directory /usr/local/lib
module directory /usr/local/lib/qemu
libexec directory /usr/local/libexec

#4 lore raw
Quoted 6 lines · Patchew Tool

This series passed Patchew automatic testing, but there are some warnings.

Find the log fragments below, or open the following URL to see the full log:

http://qemu.patchew.org/testing/log/<[email protected]>

It would be nice to encode special characters like '<' and '>' in these URLs in emails, because otherwise mail clients are less likely to treat the whole string as a single URL. (GMail for instance assumes the URL stops at '<').

If you use URLs like:
http://qemu.patchew.org/testing/log/%[email protected]%3E

then they work exactly the same only without confusing clients that auto-hyper-link text.

thanks
-- PMM

#5 lore raw
Quoted 13 lines · Peter Maydell
Quoted 6 lines · Patchew Tool

This series passed Patchew automatic testing, but there are some warnings.

Find the log fragments below, or open the following URL to see the full log:

http://qemu.patchew.org/testing/log/<[email protected]>

It would be nice to encode special characters like '<' and '>' in these URLs in emails, because otherwise mail clients are less likely to treat the whole string as a single URL. (GMail for instance assumes the URL stops at '<').

Quoted 9 lines

If you use URLs like:
http://qemu.patchew.org/testing/log/%[email protected]%3E

then they work exactly the same only without confusing clients that auto-hyper-link text.

thanks
-- PMM

I've got some patches that fix this for the web interface (since <> are invalid URL characters), I'll copy this over into the email bits, too.

Thanks,
--js

Reviewed-by
#2 lore raw
In reply to Markus Armbruster
Quoted 5 lines · Markus Armbruster
Quoted 3 lines · Markus Armbruster

Error classes are a leftover from the days of "rich" error objects. New code should always use ERROR_CLASS_GENERIC_ERROR. Commit 1d0d59f added a use of ERROR_CLASS_DEVICE_NOT_FOUND. Replace it.

"always" is a strong word; there are cases where alternate error classes are useful. But I agree that this does not seem to be one of those cases. Therefore:

Quoted 5 lines
Quoted 2 lines
 ui/vnc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#6 lore raw
In reply to Peter Maydell
Quoted 13 lines · Peter Maydell
Quoted 6 lines · Patchew Tool

This series passed Patchew automatic testing, but there are some warnings.

Find the log fragments below, or open the following URL to see the full log:

http://qemu.patchew.org/testing/log/<[email protected]>

It would be nice to encode special characters like '<' and '>' in these URLs in emails, because otherwise mail clients are less likely to treat the whole string as a single URL. (GMail for instance assumes the URL stops at '<').

Quoted 9 lines

If you use URLs like:
http://qemu.patchew.org/testing/log/%[email protected]%3E

then they work exactly the same only without confusing clients that auto-hyper-link text.

thanks
-- PMM

Good suggestion! I've done the modify locally and it will be effective after some testing. Thanks.

Fam

#7 lore raw
In reply to Markus Armbruster
Quoted 3 lines · Markus Armbruster

Error classes are a leftover from the days of "rich" error objects. New code should always use ERROR_CLASS_GENERIC_ERROR. Commit 1d0d59f added a use of ERROR_CLASS_DEVICE_NOT_FOUND. Replace it.

Forgot to spell it out: this needs to go into 2.3, because it fixes an external interface.