Strengthen precondition of ConversationController.getOrCreate
This commit is contained in:
parent
83c979fb84
commit
08f6886f3e
1 changed files with 8 additions and 0 deletions
|
@ -99,6 +99,14 @@
|
|||
return conversations.add(attributes);
|
||||
},
|
||||
getOrCreate: function(id, type) {
|
||||
if (typeof id !== 'string') {
|
||||
throw new TypeError('"id" must be a string');
|
||||
}
|
||||
|
||||
if (type !== 'private' && type !== 'group') {
|
||||
throw new TypeError('"type" must be "private" or "group"; got: ' + type);
|
||||
}
|
||||
|
||||
if (!this._initialFetchComplete) {
|
||||
throw new Error('ConversationController.get() needs complete initial fetch');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue