Something went wrong. Try again.
because I got bored of customising my CV for every job
Something went wrong. Try again.
TypeScript
1234567891011121314151617181920import { UnauthorizedException } from "@nestjs/common";
/** * Throws an UnauthorizedException with the given message. * This is useful for creating never-returning functions that help with TypeScript's control flow analysis. * * @param message - The error message to throw * @throws {UnauthorizedException} Always throws an UnauthorizedException * @returns {never} This function never returns * * @example * ```typescript * const token = getToken() ?? unauthorized("Token not found"); * // TypeScript knows token is not null/undefined after this line * ``` */export const unauthorized = (message: string): never => { throw new UnauthorizedException(message);};