diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit 10ec60f0fbf64df94a31b52ed703a82febe26afa
parent 9acfa96d0769b298bce25b752b0e7af20d446721
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Sun, 16 Jan 2022 23:16:25 +0100

feat(caldav): improve error messages

Diffstat:
Msrc/caldav.c | 11++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/caldav.c b/src/caldav.c @@ -537,15 +537,12 @@ void put_event(struct tm* date, const char* dir, size_t dir_size, char* calendar int items_read = fread(descr + descr_label_size, sizeof(char), descr_bytes, fp); if (items_read != descr_bytes) { - fprintf(stderr, "Read %i items but expected %li, aborting.", items_read, descr_bytes); + fprintf(stderr, "Error - Read %i items but expected %li, aborting.", items_read, descr_bytes); return; } descr[descr_size] = '\0'; - fprintf(stderr, "File buffer that will be uploaded to the remote CalDAV server:\n%s\n", descr); - char* folded_descr = fold(descr); - fprintf(stderr, "Folded descr:%s\n", folded_descr); char uid[9]; strftime(uid, sizeof uid, "%Y%m%d", date); @@ -565,19 +562,15 @@ void put_event(struct tm* date, const char* dir, size_t dir_size, char* calendar uid, // todo: display first few chars of DESCRIPTION as SUMMARY folded_descr); - fprintf(stderr, "PUT event postfields:\n%s\n", postfields); - strcat(calendar_uri, uid); strcat(calendar_uri, ".ics"); - fprintf(stderr, "Event uri:\n%s\n", calendar_uri); char* response = caldav_req(date, calendar_uri, "PUT", postfields, 0); - fprintf(stderr, "PUT event response:\n%s\n", response); fclose(fp); free(folded_descr); free(descr); if (response == NULL) { - fprintf(stderr, "PUT event failed.\n"); + fprintf(stderr, "Error - PUT event failed.\n"); } // free memory allocated to store curl response