Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): display module's name on .select(module) errors #12905

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/common/decorators/core/controller.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ export function Controller(
)
? [defaultPath, undefined, undefined, undefined]
: isString(prefixOrOptions) || Array.isArray(prefixOrOptions)
? [prefixOrOptions, undefined, undefined, undefined]
: [
prefixOrOptions.path || defaultPath,
prefixOrOptions.host,
{ scope: prefixOrOptions.scope, durable: prefixOrOptions.durable },
Array.isArray(prefixOrOptions.version)
? Array.from(new Set(prefixOrOptions.version))
: prefixOrOptions.version,
];
? [prefixOrOptions, undefined, undefined, undefined]
: [
prefixOrOptions.path || defaultPath,
prefixOrOptions.host,
{ scope: prefixOrOptions.scope, durable: prefixOrOptions.durable },
Array.isArray(prefixOrOptions.version)
? Array.from(new Set(prefixOrOptions.version))
: prefixOrOptions.version,
];

return (target: object) => {
Reflect.defineMetadata(CONTROLLER_WATERMARK, true, target);
Expand Down
6 changes: 4 additions & 2 deletions packages/core/errors/exceptions/unknown-module.exception.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { RuntimeException } from './runtime.exception';

export class UnknownModuleException extends RuntimeException {
constructor() {
constructor(moduleName?: string) {
super(
'Nest could not select the given module (it does not exist in current context)',
`Nest could not select the given module (${
moduleName ? `"${moduleName}"` : 'it'
} does not exist in current context).`,
);
}
}
2 changes: 1 addition & 1 deletion packages/core/nest-application-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class NestApplicationContext<

const selectedModule = modulesContainer.get(token);
if (!selectedModule) {
throw new UnknownModuleException();
throw new UnknownModuleException(type.name);
}
return new NestApplicationContext(
this.container,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/nest-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ export class NestFactoryStatic {
return result instanceof Promise
? result.then(mapToProxy)
: result instanceof NestApplication
? proxy
: result;
? proxy
: result;
};

if (!(prop in receiver) && prop in adapter) {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/router/router-response-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export class RouterResponseController {
result && result.statusCode
? result.statusCode
: redirectResponse.statusCode
? redirectResponse.statusCode
: HttpStatus.FOUND;
? redirectResponse.statusCode
: HttpStatus.FOUND;
const url = result && result.url ? result.url : redirectResponse.url;
this.applicationRef.redirect(response, statusCode, url);
}
Expand Down
6 changes: 5 additions & 1 deletion packages/microservices/server/server-rmq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ export class ServerRMQ extends Server implements CustomTransportStrategy {
(msg: Record<string, any>) => this.handleMessage(msg, channel),
{
noAck: this.noAck,
consumerTag: this.getOptionsProp(this.options, 'consumerTag', undefined)
consumerTag: this.getOptionsProp(
this.options,
'consumerTag',
undefined,
),
},
);
callback();
Expand Down
4 changes: 2 additions & 2 deletions packages/platform-socket.io/adapters/io-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export class IoAdapter extends AbstractWsAdapter {
return server && isFunction(server.of)
? server.of(namespace)
: namespace
? this.createIOServer(port, opt).of(namespace)
: this.createIOServer(port, opt);
? this.createIOServer(port, opt).of(namespace)
: this.createIOServer(port, opt);
}

public createIOServer(port: number, options?: any): any {
Expand Down
Loading