Skip to content

Commit 9c1bbf1

Browse files
committed
Breaking: Namespace#lookupEnum should actually look up the reflected enum and not just its values
1 parent d1e3122 commit 9c1bbf1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/namespace.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,16 @@ Namespace.prototype.lookupType = function lookupType(path) {
342342

343343
/**
344344
* Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace.
345-
* 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`.
345+
* Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`.
346346
* @param {string|string[]} path Path to look up
347-
* @returns {Object.<string,number>} Enum values
347+
* @returns {Enum} Looked up enum
348348
* @throws {Error} If `path` does not point to an enum
349349
*/
350350
Namespace.prototype.lookupEnum = function lookupEnum(path) {
351351
var found = this.lookup(path, [ Enum ]);
352352
if (!found)
353-
throw Error("no such enum");
354-
return found.values;
353+
throw Error("no such Enum '" + path + "' in " + this);
354+
return found;
355355
};
356356

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

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

0 commit comments

Comments
 (0)