Notification error handling, prettier timeline errors
FossilOrigin-Name: 88be2a384e2acdd83ab6dbbf97ef75a80d7a978f43500694c339d44b51ba0e8d
This commit is contained in:
parent
eaa850da87
commit
7dfb8c1257
2 changed files with 9 additions and 5 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "string_helpers.h"
|
||||
#include "easprintf.h"
|
||||
#include "status.h"
|
||||
#include "error.h"
|
||||
|
||||
// Pages
|
||||
#include "../static/notifications_page.chtml"
|
||||
|
@ -134,9 +135,13 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data)
|
|||
};
|
||||
|
||||
if (mastodont_get_notifications(api, &args, &storage, ¬ifs, ¬ifs_len) == 0)
|
||||
{
|
||||
notif_html = construct_notifications(notifs, notifs_len, NULL);
|
||||
mstdnt_cleanup_notifications(notifs, notifs_len);
|
||||
}
|
||||
else
|
||||
notif_html = construct_error("Couldn't load notifications", NULL);
|
||||
|
||||
mstdnt_cleanup_notifications(notifs, notifs_len);
|
||||
}
|
||||
|
||||
easprintf(&page, data_notifications_page_html,
|
||||
|
|
|
@ -26,13 +26,13 @@
|
|||
#include "reply.h"
|
||||
#include "navigation.h"
|
||||
#include "query.h"
|
||||
#include "error.h"
|
||||
#include "string_helpers.h"
|
||||
|
||||
#include "../static/navigation.chtml"
|
||||
|
||||
void tl_public(struct session* ssn, mastodont_t* api, int local)
|
||||
{
|
||||
int cleanup = 0;
|
||||
size_t status_count, statuses_html_count;
|
||||
struct mstdnt_status* statuses = NULL;
|
||||
struct mstdnt_storage storage = { 0 };
|
||||
|
@ -56,14 +56,13 @@ void tl_public(struct session* ssn, mastodont_t* api, int local)
|
|||
|
||||
if (mastodont_timeline_public(api, &args, &storage, &statuses, &status_count))
|
||||
{
|
||||
status_format = "An error occured loading the timeline";
|
||||
status_format = construct_error("An error occured loading the timeline", NULL);
|
||||
}
|
||||
else {
|
||||
// Construct statuses into HTML
|
||||
status_format = construct_statuses(statuses, status_count, &statuses_html_count);
|
||||
if (!status_format)
|
||||
status_format = "Error in malloc!";
|
||||
cleanup = 1;
|
||||
}
|
||||
|
||||
// Create post box
|
||||
|
@ -95,7 +94,7 @@ void tl_public(struct session* ssn, mastodont_t* api, int local)
|
|||
// Cleanup
|
||||
mastodont_storage_cleanup(&storage);
|
||||
mstdnt_cleanup_statuses(statuses, status_count);
|
||||
if (cleanup) free(status_format);
|
||||
if (status_format) free(status_format);
|
||||
if (post_box) free(post_box);
|
||||
if (navigation_box) free(navigation_box);
|
||||
if (output) free(output);
|
||||
|
|
Loading…
Reference in a new issue