1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

return status code in error cases too

This commit is contained in:
Daniel Waxweiler
2024-04-03 22:43:49 +02:00
parent 2889edcb4c
commit 5988457253

View File

@ -44,9 +44,9 @@ class Api {
}
return $events;
} catch (GeneralException $e) {
return 'The events could not be loaded!';
return new \WP_Error('events_not_loading', 'The events could not be loaded!', array('status' => 500));
} catch (GroupNotFoundException $e) {
return sprintf('The group "%s" could not be found!', $groupName);
return new \WP_Error('group_not_found', sprintf('The group "%s" could not be found!', $groupName), array('status' => 404));
}
}
}