mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Refactor exception usage
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import * as Sequelize from 'sequelize'
|
||||
import { ValidationException } from '../exception'
|
||||
import { MinuteOfDay } from '../util/minuteofday'
|
||||
import { booleanColumn, familyIdColumn, idWithinFamilyColumn } from './columns'
|
||||
import { SequelizeAttributes } from './types'
|
||||
@@ -90,11 +91,11 @@ export const attributesVersion2: SequelizeAttributes<TimelimitRuleAttributesVers
|
||||
const startMinuteOfDay = this.startMinuteOfDay
|
||||
|
||||
if (typeof endMinuteOfDay !== 'number' || typeof startMinuteOfDay !== 'number') {
|
||||
throw new Error('wrong data types')
|
||||
throw new ValidationException({ staticMessage: 'wrong data types for start and end minute at the time limit rule' })
|
||||
}
|
||||
|
||||
if (startMinuteOfDay > endMinuteOfDay) {
|
||||
throw new Error('startMinuteOfDay must not be bigger than endMinuteOfDay')
|
||||
throw new ValidationException({ staticMessage: 'startMinuteOfDay must not be bigger than endMinuteOfDay for a time limit rule' })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user