mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 00:07:22 +00:00
RRule error handling #422
This commit is contained in:
parent
f93bb4c65f
commit
8fdcbe9457
@ -1354,7 +1354,7 @@
|
||||
element.find('.rioccurrences').show();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
alert(textStatus + " " + jqXHR.statusText + " " + jqXHR.responseText);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -275,10 +275,14 @@ def event_rrule():
|
||||
|
||||
from project.dateutils import calculate_occurrences
|
||||
|
||||
result = calculate_occurrences(
|
||||
start_date, '"%d.%m.%Y"', rrule_str, start, batch_size
|
||||
)
|
||||
return jsonify(result)
|
||||
try:
|
||||
result = calculate_occurrences(
|
||||
start_date, '"%d.%m.%Y"', rrule_str, start, batch_size
|
||||
)
|
||||
return jsonify(result)
|
||||
except Exception as e:
|
||||
app.logger.exception(request.json)
|
||||
return str(e), 400
|
||||
|
||||
|
||||
def get_event_category_choices():
|
||||
|
||||
@ -643,6 +643,21 @@ def test_rrule(client, seeder, utils, app):
|
||||
assert occurence["formattedDate"] == '"25.11.2020"'
|
||||
|
||||
|
||||
def test_rrule_bad_request(client, seeder, utils, app):
|
||||
url = utils.get_url("event_rrule")
|
||||
response = utils.post_json(
|
||||
url,
|
||||
{
|
||||
"year": 2020,
|
||||
"month": 11,
|
||||
"day": 25,
|
||||
"rrule": "RRULE:FREQ=DAILY;COUNT=7bad",
|
||||
"start": 0,
|
||||
},
|
||||
)
|
||||
utils.assert_response_bad_request(response)
|
||||
|
||||
|
||||
def test_report(seeder, utils):
|
||||
user_id, admin_unit_id = seeder.setup_base()
|
||||
event_id = seeder.create_event(admin_unit_id)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user