mirror of
https://github.com/koel/koel
synced 2024-11-10 14:44:13 +00:00
Throw an error if model factory is not found
This commit is contained in:
parent
eab3212bb2
commit
5b691d6214
1 changed files with 4 additions and 0 deletions
|
@ -6,6 +6,10 @@ import video from './video'
|
|||
const models = { artist, album, song, video }
|
||||
|
||||
const factory = (model, count = 1, overrides = {}) => {
|
||||
if (!(model in models)) {
|
||||
throw new Error(`Model \`${model}\` not found`)
|
||||
}
|
||||
|
||||
if (typeof count === 'object') {
|
||||
return factory(model, 1, count)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue