NetworkManager/src/platform/tests
Thomas Haller 68a4ffb4e2 platform: drop nm_platform_get_error()
For NMPlatform instances we had an error reporting mechanism
which stores the last error reason in a private field. Later we
would check it via nm_platform_get_error().

Remove this. It was not used much, and it is not a great way
to report errors.

One problem is that at the point where the error happens, you don't
know whether anybody cares about an error code. So, you add code to set
the error reason because somebody *might* need it (but in realitiy, almost
no caller cares).
Also, we tested this functionality which is hardly used in non-testing code.
While this was a burden to maintain in the tests, it was likely still buggy
because there were no real use-cases, beside the tests.

Then, sometimes platform functions call each other which might overwrite the
error reason. So, every function must be cautious to preserve/set
the error reason according to it's own meaning. This can involve storing
the error code, calling another function, and restoring it afterwards.
This is harder to get right compared to a "return-error-code" pattern, where
every function manages its error code independently.

It is better to return the error reason whenever due. For that we already
have our common glib patterns

    (1) gboolean fcn (...);
    (2) gboolean fcn (..., GError **error);

In few cases, we need more details then a #gboolean, but don't want
to bother constructing a #GError. Then we should do instead:

    (3) NMPlatformError fcn (...);
2015-06-17 11:44:16 +02:00
..
.gitignore platform: add nmp-object.h file 2015-06-17 11:23:51 +02:00
dump.c platform: no longer expose udi field in NMPlatformLink 2015-06-17 11:41:43 +02:00
Makefile.am platform: add nmp-object.h file 2015-06-17 11:23:51 +02:00
monitor.c all: consistently include config.h 2014-11-13 17:18:42 -05:00
platform.c platform: drop nm_platform_get_error() 2015-06-17 11:44:16 +02:00
test-address.c platform: drop nm_platform_get_error() 2015-06-17 11:44:16 +02:00
test-cleanup.c platform: signal missing firmware in nm_platform_set_up() 2015-06-17 11:44:16 +02:00
test-common.c all: fix a compiler warning about function declarations 2015-06-10 10:01:49 +02:00
test-common.h platform: drop nm_platform_get_error() 2015-06-17 11:44:16 +02:00
test-general.c platform/test: add simple test for NMLinuxPlatform 2015-06-17 11:41:42 +02:00
test-link.c platform: drop nm_platform_get_error() 2015-06-17 11:44:16 +02:00
test-nmp-object.c platform: implement NMPObject and NMPCache 2015-06-17 11:23:51 +02:00
test-route.c platform: drop nm_platform_get_error() 2015-06-17 11:44:16 +02:00