mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Adds NotificationCenter exception when triggering unknown topic
If you forget to add a certain topic to the Nc, you will now get an Exception with a meaningful message.
This commit is contained in:
parent
dba743cd7b
commit
062402db58
1 changed files with 4 additions and 2 deletions
|
|
@ -23,7 +23,6 @@ function (Exception) {
|
||||||
this.topics = {};
|
this.topics = {};
|
||||||
this.subUid = -1;
|
this.subUid = -1;
|
||||||
|
|
||||||
var i = 0;
|
|
||||||
this.ns = {
|
this.ns = {
|
||||||
client: {
|
client: {
|
||||||
pointerLock: {
|
pointerLock: {
|
||||||
|
|
@ -195,11 +194,14 @@ function (Exception) {
|
||||||
};
|
};
|
||||||
|
|
||||||
populate(this.ns);
|
populate(this.ns);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NotificationCenter.prototype.validate = function(topic) {
|
NotificationCenter.prototype.validate = function(topic) {
|
||||||
|
if (topic === undefined) {
|
||||||
|
throw new Exception("Topic not registered in Nc. See stack trace.");
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof topic === 'object') {
|
if (typeof topic === 'object') {
|
||||||
throw new Exception("Topic bad format " + JSON.stringify(topic));
|
throw new Exception("Topic bad format " + JSON.stringify(topic));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue