trivial: Use a better error message disambiguate an error message

This commit is contained in:
Richard Hughes 2022-06-23 08:52:58 +01:00
parent 030a0d51c1
commit a70d005ea3
6 changed files with 45 additions and 11 deletions

View File

@ -488,7 +488,10 @@ fu_cfi_device_chip_select(FuCfiDevice *self, gboolean value, GError **error)
g_return_val_if_fail(FU_IS_CFI_DEVICE(self), FALSE); g_return_val_if_fail(FU_IS_CFI_DEVICE(self), FALSE);
g_return_val_if_fail(error == NULL || *error == NULL, FALSE); g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
if (klass->chip_select == NULL) { if (klass->chip_select == NULL) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "not supported"); g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"chip select is not implemented on this device");
return FALSE; return FALSE;
} }
return klass->chip_select(self, value, error); return klass->chip_select(self, value, error);

View File

@ -16,7 +16,10 @@
GPtrArray * GPtrArray *
fu_common_get_block_devices(GError **error) fu_common_get_block_devices(GError **error)
{ {
g_set_error(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "not supported"); g_set_error(error,
G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"getting block devices is not supported on Darwin");
return NULL; return NULL;
} }

View File

@ -18,7 +18,10 @@
GPtrArray * GPtrArray *
fu_common_get_block_devices(GError **error) fu_common_get_block_devices(GError **error)
{ {
g_set_error(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "not supported"); g_set_error(error,
G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"getting block devices is not supported on Windows");
return NULL; return NULL;
} }

View File

@ -3819,7 +3819,10 @@ fu_device_get_results(FuDevice *self, GError **error)
/* no plugin-specific method */ /* no plugin-specific method */
if (klass->get_results == NULL) { if (klass->get_results == NULL) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "not supported"); g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"getting results not supported by device");
return FALSE; return FALSE;
} }
@ -3859,7 +3862,10 @@ fu_device_write_firmware(FuDevice *self,
/* no plugin-specific method */ /* no plugin-specific method */
if (klass->write_firmware == NULL) { if (klass->write_firmware == NULL) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "not supported"); g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"writing firmware not supported by device");
return FALSE; return FALSE;
} }
@ -3994,7 +4000,10 @@ fu_device_read_firmware(FuDevice *self, FuProgress *progress, GError **error)
/* device does not support reading for verification CRCs */ /* device does not support reading for verification CRCs */
if (!fu_device_has_flag(self, FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE)) { if (!fu_device_has_flag(self, FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE)) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "not supported"); g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"reading firmware is not supported by device");
return NULL; return NULL;
} }
@ -4035,7 +4044,10 @@ fu_device_dump_firmware(FuDevice *self, FuProgress *progress, GError **error)
/* use the default FuFirmware when only ->dump_firmware is provided */ /* use the default FuFirmware when only ->dump_firmware is provided */
if (klass->dump_firmware == NULL) { if (klass->dump_firmware == NULL) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "not supported"); g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"dumping firmware is not supported by device");
return NULL; return NULL;
} }
@ -4756,7 +4768,10 @@ fu_device_bind_driver(FuDevice *self, const gchar *subsystem, const gchar *drive
/* not implemented */ /* not implemented */
if (klass->bind_driver == NULL) { if (klass->bind_driver == NULL) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "not supported"); g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"binding drivers is not supported by device");
return FALSE; return FALSE;
} }
@ -4789,7 +4804,10 @@ fu_device_unbind_driver(FuDevice *self, GError **error)
/* not implemented */ /* not implemented */
if (klass->unbind_driver == NULL) { if (klass->unbind_driver == NULL) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "not supported"); g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"unbinding drivers is not supported by device");
return FALSE; return FALSE;
} }

View File

@ -1759,7 +1759,10 @@ fu_udev_device_get_sysfs_attr(FuUdevDevice *self, const gchar *attr, GError **er
return result; return result;
#else #else
g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_FAILED, "not supported"); g_set_error_literal(error,
G_IO_ERROR,
G_IO_ERROR_FAILED,
"getting attributes is not supported as no GUdev support");
return NULL; return NULL;
#endif #endif
} }

View File

@ -155,7 +155,11 @@ fu_vli_pd_parade_device_read_fw_ver(FuVliPdParadeDevice *self, GError **error)
if (!fu_vli_pd_parade_device_i2c_read(self, self->page7, 0x02, buf, 0x1, error)) if (!fu_vli_pd_parade_device_i2c_read(self, self->page7, 0x02, buf, 0x1, error))
return FALSE; return FALSE;
if (buf[0] != 0x01 && buf[0] != 0x02) { if (buf[0] != 0x01 && buf[0] != 0x02) {
g_set_error(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "not supported"); g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"not supported on this device: buffer was 0x%02x",
buf[0]);
return FALSE; return FALSE;
} }