Skip to content

Commit

Permalink
Breaking: Namespace#lookupEnum should actually look up the reflected …
Browse files Browse the repository at this point in the history
…enum and not just its values
  • Loading branch information
dcodeIO committed Apr 2, 2017
1 parent d1e3122 commit 9c1bbf1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,16 @@ Namespace.prototype.lookupType = function lookupType(path) {

/**
* Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.
* Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it returns the enum's values directly and throws instead of returning `null`.
* Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.
* @param {string|string[]} path Path to look up
* @returns {Object.<string,number>} Enum values
* @returns {Enum} Looked up enum
* @throws {Error} If `path` does not point to an enum
*/
Namespace.prototype.lookupEnum = function lookupEnum(path) {
var found = this.lookup(path, [ Enum ]);
if (!found)
throw Error("no such enum");
return found.values;
throw Error("no such Enum '" + path + "' in " + this);
return found;
};

/**
Expand All @@ -364,7 +364,7 @@ Namespace.prototype.lookupEnum = function lookupEnum(path) {
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {
var found = this.lookup(path, [ Type, Enum ]);
if (!found)
throw Error("no such type or enum");
throw Error("no such Type or Enum '" + path + "' in " + this);
return found;
};

Expand All @@ -378,7 +378,7 @@ Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {
Namespace.prototype.lookupService = function lookupService(path) {
var found = this.lookup(path, [ Service ]);
if (!found)
throw Error("no such service");
throw Error("no such Service '" + path + "' in " + this);
return found;
};

Expand Down

0 comments on commit 9c1bbf1

Please sign in to comment.