transport: clarify error message when transport is not selected 06/2406/2
authorKarl Palsson <karlp@tweak.net.au>
Fri, 21 Nov 2014 22:05:41 +0000 (22:05 +0000)
committerSpencer Oliver <spen@spen-soft.co.uk>
Fri, 9 Jan 2015 08:48:18 +0000 (08:48 +0000)
When no transport is selected, the error message dumps the available
transports, but not how to actually select one.

Change-Id: I63da2a4b59e3f6cc8d30bd631e41a82636a056ef
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2406
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/transport/transport.c

index 3f5337e..c57064b 100644 (file)
@@ -239,12 +239,13 @@ COMMAND_HANDLER(handle_transport_init)
 {
        LOG_DEBUG("%s", __func__);
        if (!session) {
-               LOG_ERROR("session's transport is not selected.");
+               LOG_ERROR("session transport was not selected. Use 'transport select <transport>'");
 
                /* no session transport configured, print transports then fail */
+               LOG_ERROR("Transports available:");
                const char * const *vector = allowed_transports;
                while (*vector) {
-                       LOG_ERROR("allow transport '%s'", *vector);
+                       LOG_ERROR("%s", *vector);
                        vector++;
                }
                return ERROR_FAIL;
@@ -277,7 +278,7 @@ static int jim_transport_select(Jim_Interp *interp, int argc, Jim_Obj * const *a
        switch (argc) {
                case 1:         /* return/display */
                        if (!session) {
-                               LOG_ERROR("session's transport is not selected.");
+                               LOG_ERROR("session transport was not selected. Use 'transport select <transport>'");
                                return JIM_ERR;
                        } else {
                                Jim_SetResultString(interp, session->name, -1);