Skip to content

Commit 8e38bac

Browse files
committed
imp(): throw exceptions
1 parent 245361f commit 8e38bac

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/models/eventsFactory.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ class EventsFactory extends Factory {
556556
* If one of the ids are invalid (originalEvent or repetition not found) return null
557557
*/
558558
if (!originalEvent || !repetition) {
559-
return null;
559+
throw new Error(`Cant find event repetition for repetitionId: ${repetitionId} and originalEventId: ${originalEventId}`);
560560
}
561561

562562
return this._composeEventWithRepetition(originalEvent, repetition);
@@ -610,7 +610,7 @@ class EventsFactory extends Factory {
610610
const event = await this.findById(eventId);
611611

612612
if (!event) {
613-
return null;
613+
throw new Error(`Event not found for eventId: ${eventId}`);
614614
}
615615

616616
return this.getCollection(this.TYPES.EVENTS)
@@ -634,7 +634,7 @@ class EventsFactory extends Factory {
634634
const event = await this.findById(eventId);
635635

636636
if (!event) {
637-
return null;
637+
throw new Error(`Event not found for eventId: ${eventId}`);
638638
}
639639

640640
const query = { _id: new ObjectID(event._id) };
@@ -692,7 +692,7 @@ class EventsFactory extends Factory {
692692
const event = await this.findById(eventId);
693693

694694
if (!event) {
695-
return null;
695+
throw new Error(`Event not found for eventId: ${eventId}`);
696696
}
697697

698698
const query = { _id: new ObjectID(event._id) };

src/typeDefs/event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ type Event {
243243
timestamp: Float!
244244
245245
"""
246-
First appearance timestamp
246+
First occurrence timestamp
247247
"""
248248
originalTimestamp: Float!
249249

0 commit comments

Comments
 (0)