Refactor exception usage

This commit is contained in:
Jonas Lochmann
2020-09-28 02:00:00 +02:00
parent d68b425e0e
commit 8d65c5d777
148 changed files with 2061 additions and 769 deletions
+5 -4
View File
@@ -15,9 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { assertNonEmptyListWithoutDuplicates } from '../util/list'
import { assertIdWithinFamily } from '../util/token'
import { ParentAction } from './basetypes'
import { assertIdWithinFamily, assertNonEmptyListWithoutDuplicates } from './meta/util'
const actionType = 'RemoveCategoryAppsAction'
export class RemoveCategoryAppsAction extends ParentAction {
readonly categoryId: string
@@ -26,8 +27,8 @@ export class RemoveCategoryAppsAction extends ParentAction {
constructor ({ categoryId, packageNames }: {categoryId: string, packageNames: Array<string>}) {
super()
assertIdWithinFamily(categoryId)
assertNonEmptyListWithoutDuplicates(packageNames)
assertIdWithinFamily({ actionType, field: 'categoryId', value: categoryId })
assertNonEmptyListWithoutDuplicates({ actionType, field: 'packageNames', list: packageNames })
this.categoryId = categoryId
this.packageNames = packageNames