diff options
author | Gary E. Miller <gem@rellim.com> | 2009-11-11 07:18:39 +0000 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2009-11-11 07:18:39 +0000 |
commit | 6319e80f9e2f7f7ebac8fd153bb9ce48496f4842 (patch) | |
tree | 1b2729cbe52e8934c90e8817fbfb4bb9159e1525 /gpsd.c | |
parent | 206ea8ecc5c4b4a1425d27ff04d23a1f424d8db1 (diff) | |
download | gpsd-6319e80f9e2f7f7ebac8fd153bb9ce48496f4842.tar.gz |
Add some gpsd side JSON error reporting.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1599,6 +1599,7 @@ static void handle_newstyle_request(struct subscriber_t *sub, (void)snprintf(reply, replylen, "{\"class\":\"ERROR\",\"message\":\"Invalid WATCH: %s\"}\r\n", json_error_string(status)); + gpsd_report(LOG_ERROR, reply); } else if (sub->policy.watcher) { if (sub->policy.devpath[0] == '\0') { /* assign all devices */ @@ -1610,10 +1611,12 @@ static void handle_newstyle_request(struct subscriber_t *sub, if (devp == NULL) { (void)snprintf(reply, replylen, "{\"class\":\"ERROR\",\"message\":\"Do nuch device as %s\"}\r\n", sub->policy.devpath); + gpsd_report(LOG_ERROR, reply); goto bailout; } else if (assign_channel(sub, ANY, devp) == NULL) (void)snprintf(reply, replylen, "{\"class\":\"ERROR\",\"message\":\"Can't assign %s\"}\r\n", sub->policy.devpath); + gpsd_report(LOG_ERROR, reply); goto bailout; } } @@ -1645,6 +1648,7 @@ static void handle_newstyle_request(struct subscriber_t *sub, (void)snprintf(reply, replylen, "{\"class\":\"ERROR\",\"message\":\"Invalid DEVICE: %s\"}\r\n", json_error_string(status)); + gpsd_report(LOG_ERROR, reply); goto bailout; } else { if (devconf.path[0]!='\0') { @@ -1653,6 +1657,7 @@ static void handle_newstyle_request(struct subscriber_t *sub, (void)snprintf(reply, replylen, "{\"class\":\"ERROR\",\"message\":\"Can't open %s.\"}\r\n", devconf.path); + gpsd_report(LOG_ERROR, reply); goto bailout; } } else { @@ -1662,10 +1667,12 @@ static void handle_newstyle_request(struct subscriber_t *sub, (void)strlcat(reply, "{\"class\":\"ERROR\",\"message\":\"Can't perform DEVICE configuration, no channels attached.\"}\r\n", replylen); + gpsd_report(LOG_ERROR, reply); goto bailout; } else if (chcount > 1) { (void)snprintf(reply+strlen(reply), replylen-strlen(reply), "{\"class\":\"ERROR\",\"message\":\"No path specified in DEVICE, but multiple channels are subscribed.\"}\r\n"); + gpsd_report(LOG_ERROR, reply); goto bailout; } else { /* we should have exactly one device now */ @@ -1739,6 +1746,7 @@ static void handle_newstyle_request(struct subscriber_t *sub, (void)snprintf(reply, replylen, "{\"class\":\"ERROR\",\"message\":\"Unrecognized request '%.*s'\"}\r\n", (int)(errend-buf+1), buf); + gpsd_report(LOG_ERROR, reply); buf += strlen(buf); } bailout: |