measurence / kippino

A Slack bot that keeps track of your KPIs
MIT License
15 stars 1 forks source link

Bot should not crash if KPI period is invalid #10

Closed cloudify closed 7 years ago

cloudify commented 7 years ago

For instance if a weekly KPI has a starting date not on a Monday:

/src/Week.ts:18
      throw new TypeError("Week can be created only from dates that are Mondays")
            ^
TypeError: Week can be created only from dates that are Mondays
    at new Week (/src/Week.ts:18:13)
    at Function.KPI.getKpiPeriodFromDate (/src/KPI.ts:29:22)
    at KPI.getFirstKpiPeriod (/src/KPI.ts:56:16)
    at /src/index.ts:300:11
    at Array.reduce (native)
    at getKpisThatNeedsUpdate (/src/index.ts:292:22)
    at MapSubscriber.project (/src/index.ts:361:25)
    at MapSubscriber._next (/node_modules/@reactivex/rxjs/dist/cjs/src/operator/map.ts:75:29)
    at MapSubscriber.Subscriber.next (/node_modules/@reactivex/rxjs/dist/cjs/src/Subscriber.ts:95:12)
    at CombineLatestSubscriber._tryProject (/node_modules/@reactivex/rxjs/dist/cjs/src/operator/combineLatest.ts:161:22)