@nestjs/common#HttpException TypeScript Examples

The following examples show how to use @nestjs/common#HttpException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: plugin-newsletter.controller.ts    From Cromwell with MIT License 7 votes vote down vote up
@Post('subscribe')
    /** Use ThrottlerGuard to limit number of requests from one IP address. Allow max 4 requests in 20 seconds: */
    @UseGuards(ThrottlerGuard)
    @Throttle(4, 20)
    @ApiOperation({ description: 'Post email to subscribe for newsletters' })
    @ApiResponse({
        status: 200,
        type: Boolean,
    })
    @ApiBody({ type: PluginNewsletterSubscription })
    @ApiForbiddenResponse({ description: 'Forbidden.' })
    async placeSubscription(@Body() input: PluginNewsletterSubscription): Promise<boolean | undefined> {
        const email = input?.email;
        if (!email || !/\S+@\S+\.\S+/.test(email)) {
            throw new HttpException(`Invalid email`, HttpStatus.BAD_REQUEST);
        }

        const hasSubscribed = await getManager().findOne(PluginNewsletter, {
            where: {
                email
            }
        });
        if (hasSubscribed) return true;

        const newsletter = new PluginNewsletter();
        newsletter.email = email;
        await getManager().save(newsletter);
        return true;
    }
Example #2
Source File: whisp.service.ts    From whispr with MIT License 7 votes vote down vote up
private static fillTTL(whisp: WhispInputType, updated: Date): { timeToLiveSec: number; expirationDate: Date } {
    const expDate = new Date(updated);
    if (whisp.expirationDate) {
      return { timeToLiveSec: null, expirationDate: whisp.expirationDate };
    }

    if (whisp.timeToLive) {
      let ttl = Number(whisp.timeToLive);

      if (Number.isNaN(ttl)) {
        ttl = parse(whisp.timeToLive, 's');
      }

      if (!ttl || ttl < 1) {
        throw new HttpException(
          'time to live must be positive number of seconds or a parsable time string like 2min,1hour',
          HttpStatus.BAD_REQUEST,
        );
      } else {
        expDate.setSeconds(expDate.getSeconds() + ttl);
        return { timeToLiveSec: ttl, expirationDate: expDate };
      }
    } else {
      return { timeToLiveSec: null, expirationDate: null };
    }
  }
Example #3
Source File: http-exception.filter.ts    From Phantom with MIT License 6 votes vote down vote up
catch(exception: HttpException, host: ArgumentsHost) {
    const ctx = host.switchToHttp();
    const response = ctx.getResponse();
    const request = ctx.getRequest();
    const status = exception.getStatus
      ? exception.getStatus()
      : HttpStatus.INTERNAL_SERVER_ERROR;

    const errorResponse = {
      code: status,
      timestamp: new Date().toLocaleDateString(),
      path: request.url,
      method: request.method,
      message:
        status !== HttpStatus.INTERNAL_SERVER_ERROR
          ? exception.message || null
          : 'Internal server error',
    };

    response.status(status).json(errorResponse);
  }
Example #4
Source File: base-api.exception.ts    From nestjs-starter-rest-api with MIT License 6 votes vote down vote up
export class BaseApiException extends HttpException {
  public localizedMessage: Record<string, string>;
  public details: string | Record<string, any>;

  constructor(
    message: string,
    status: number,
    details?: string | Record<string, any>,
    localizedMessage?: Record<string, string>,
  ) {
    // Calling parent constructor of base Exception class.
    super(message, status);
    this.name = BaseApiException.name;
    this.localizedMessage = localizedMessage;
    this.details = details;
  }
}
Example #5
Source File: user.service.ts    From Phantom with MIT License 6 votes vote down vote up
/**
   * @author Aya Abohadima <[email protected]>
   * @description get user by id
   * @param {string} id - user id wanted to get
   * @returns {object<User>}
   */
  async getUserById(id) {
    const user = await this.userModel.findById(id);
    if (!user)
      throw new HttpException('Unauthorized access', HttpStatus.UNAUTHORIZED);
    if (!user.about) user.about = '';
    return user;
  }
Example #6
Source File: faucet-transactions.controller.ts    From ironfish-api with Mozilla Public License 2.0 6 votes vote down vote up
@ApiExcludeEndpoint()
  @Post()
  async create(
    @Body(
      new ValidationPipe({
        errorHttpStatusCode: HttpStatus.UNPROCESSABLE_ENTITY,
      }),
    )
    { email, public_key: publicKey }: CreateFaucetTransactionDto,
  ): Promise<SerializedFaucetTransaction> {
    if (this.config.get<boolean>('DISABLE_FAUCET')) {
      throw new HttpException(
        {
          status: HttpStatus.FORBIDDEN,
          message: 'The faucet has been disabled, try joining a mining pool!',
        },
        HttpStatus.FORBIDDEN,
      );
    }
    return serializedFaucetTransactionFromRecord(
      await this.faucetTransactionsService.create({ email, publicKey }),
    );
  }
Example #7
Source File: hefeng-public.service.ts    From life-helper-backend with MIT License 6 votes vote down vote up
/**
   * 通过经纬度坐标查询和风天气的 `LocationID`
   *
   * @param longitude 经度
   * @param latitude 纬度
   */
  async getLocationIdByCoordinate(longitude: number, latitude: number): Promise<string> {
    const location = this.transformCoordinate(longitude, latitude)

    const cities = await this.hefengCachedService.searchCity(location)
    if (cities.length > 0) {
      return cities[0].id
    } else {
      throw new HttpException(INVALID_LOCATION, HttpStatus.BAD_REQUEST)
    }
  }
Example #8
Source File: user.service.ts    From Phantom with MIT License 6 votes vote down vote up
/**
   * @author Aya Abohadima <[email protected]>
   * @description get user by findData and get only from user data
   * @param {Object} findData - user data wanted to get
   * @param {Object} data - data should get
   * @returns {Object}
   */
  async findUserAndGetData(findData: {}, data: {}) {
    let user = await this.userModel.findOne(findData, data);
    if (!user)
      throw new HttpException('Unauthorized access', HttpStatus.UNAUTHORIZED);
    return user;
  }
Example #9
Source File: hefeng-http.service.ts    From life-helper-backend with MIT License 6 votes vote down vote up
/**
   * 获取实时天气数据
   *
   * @param location 需要查询地区的 `LocationID` 或以英文逗号分隔的 `经度,纬度` 坐标(十进制)
   *
   * @see
   * [API 开发文档](https://dev.qweather.com/docs/api/weather/weather-now/)
   */
  async getWeatherNow(location: string): Promise<WeatherNow> {
    const { key, baseURL } = HefengConfig.basic

    const response = await request<HefengResponse>({
      baseURL,
      url: '/weather/now',
      params: {
        key,
        location,
      },
    })

    if (response.data.code === '200') {
      // `code` 为 `200` 表示请求成功
      return response.data.now as WeatherNow
    } else {
      // 失败情况
      this.logger.error(`[接口请求错误] 和风天气 - 实时天气, 响应 code => \`${response.data.code}\`,  location => \`${location}\` `)

      if (this.invalidLocationCodes.includes(response.data.code)) {
        throw new HttpException(INVALID_LOCATION, HttpStatus.BAD_REQUEST)
      } else {
        throw new HttpException(COMMON_SERVER_ERROR, HttpStatus.INTERNAL_SERVER_ERROR)
      }
    }
  }
Example #10
Source File: user.service.ts    From Phantom with MIT License 6 votes vote down vote up
/**
   * @author Aya Abohadima <[email protected]>
   * @description get user by login
   * @param {LoginDto} loginDto - email of user & password
   * @returns {object} object of _id :id of user , profileImage : user image & email :user email
   */
  async findByLogin(loginDto: LoginDto) {
    const user = await this.findUserAndGetData(
      { email: loginDto.email },
      { password: 1, profileImage: 1, email: 1, _id: 1 },
    ).catch(err => {
      console.log(err);
    });
    if (!user)
      throw new HttpException('not user by this email', HttpStatus.FORBIDDEN);
    if (await bcrypt.compare(loginDto.password, user.password)) {
      return user;
    }
    throw new HttpException('password is not correct', HttpStatus.FORBIDDEN);
  }
Example #11
Source File: weixin.service.ts    From life-helper-backend with MIT License 6 votes vote down vote up
/**
   * 封装好获取微信服务端凭证的请求接口
   *
   * @param options 请求配置
   *
   * @description
   * 注意:非文本请求不要使用当前方法
   */
  async request<T extends BasicWeixinResponse>(options: AxiosRequestConfig) {
    const token = await this.getAccessToken()
    const params = options.params || {}
    params.access_token = token
    options.params = params

    const response = await axios.request<T>(options)
    if (!response.data.errcode) {
      return response.data
    }

    this.logger.error(`[微信服务端 API] 调用失败,错误码:${response.data.errcode},错误原因:${response.data.errmsg}`)

    // 第一次没有成功,重新获取 token,然后再试一遍
    const refreshedToken = await await this.getAccessToken(true)
    options.params.access_token = refreshedToken

    const response2 = await axios.request<T>(options)
    if (!response2.data.errcode) {
      return response2.data
    }

    this.logger.error(`[微信服务端 API] 调用失败,错误码:${response2.data.errcode},错误原因:${response2.data.errmsg}`)
    throw new HttpException(COMMON_SERVER_ERROR, HttpStatus.INTERNAL_SERVER_ERROR)
  }
Example #12
Source File: user.service.ts    From Phantom with MIT License 6 votes vote down vote up
/**
   * @author Aya Abohadima <[email protected]>
   * @description check update data after update
   * @param {UpdateDto} updateDto - data need to update
   */
  async checkUpdateData(updateDto: UpdateDto) {
    const shcema = Joi.object({
      email: Joi.string()
        .trim()
        .email()
        .optional(),
      password: Joi.string().optional(),
      birthDate: Joi.date()
        .raw()
        .optional(),
      firstName: Joi.string().optional(),
      lastName: Joi.string().optional(),
      country: Joi.string().optional(),
      location: Joi.string().optional(),
      userName: Joi.string().optional(),
      gender: Joi.string().optional(),
      bio: Joi.string().optional(),
      iat: Joi.optional(),
      exp: Joi.optional(),
      profileImage: Joi.string().optional(),
    });
    const body = updateDto;
    const validate = shcema.validate(body);
    if (validate.error)
      throw new HttpException(validate.error, HttpStatus.FORBIDDEN);
    if (updateDto.email)
      if (await this.checkMAilExistAndFormat(updateDto.email))
        throw new HttpException(
          '"email" should not have acount',
          HttpStatus.FORBIDDEN,
        );
  }
Example #13
Source File: error-catch.filter.ts    From erda-ui with GNU Affero General Public License v3.0 6 votes vote down vote up
catch(exception: Error, host: ArgumentsHost) {
    const ctx = host.switchToHttp();
    const response = ctx.getResponse();
    const request = ctx.getRequest();

    const status = exception instanceof HttpException ? exception.getStatus() : HttpStatus.INTERNAL_SERVER_ERROR;

    logger.error('unexpected exception:', exception);

    response.status(status).json({
      statusCode: status,
      timestamp: new Date().toISOString(),
      path: request.url,
    });
  }
Example #14
Source File: user.service.ts    From Phantom with MIT License 6 votes vote down vote up
/**
   * @author Aya Abohadima <[email protected]>
   * @description check email in formate and if exist
   * @param {String} email - email should check
   * @returns  {Object<User>}
   */
  async checkMAilExistAndFormat(email) {
    const body = { email: email };
    const shcema = Joi.object({
      email: Joi.string()
        .trim()
        .email()
        .required(),
    });
    const validate = shcema.validate(body);
    if (validate.error != null)
      throw new HttpException(validate.error, HttpStatus.FORBIDDEN);
    const user = await this.userModel
      .findOne(
        { email: email },
        {
          password: 1,
          _id: 1,
          email: 1,
          fcmToken: 1,
          location: 1,
          firstName: 1,
        },
      )
      .lean();
    return user;
  }
Example #15
Source File: http-exception.filter.ts    From codeclannigeria-backend with MIT License 6 votes vote down vote up
@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
  catch(error: any, host: ArgumentsHost) {
    const ctx = host.switchToHttp();
    const res = ctx.getResponse() as Response;
    const req = ctx.getRequest();
    const statusCode = error.getStatus();
    const stacktrace =
      configuration().environment === 'production' ? null : error.stack;
    const errorName = error.response.name || error.response.error || error.name;
    const errors = error.response.errors || null;
    const path = req ? req.url : null;

    if (statusCode === HttpStatus.UNAUTHORIZED) {
      if (typeof error.response !== 'string') {
        error.response.message =
          error.response.message ||
          'You do not have permission to access this resource';
      }
    }

    const exception = new ApiException(
      error.response.message,
      errorName,
      stacktrace,
      errors,
      path,
      statusCode
    );
    res.status(statusCode).json(exception);
  }
}
Example #16
Source File: http-exception.filter.ts    From nestjs-crud-prisma with MIT License 6 votes vote down vote up
@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
  catch(exception: HttpException, host: ArgumentsHost) {
    const ctx = host.switchToHttp();
    const response = ctx.getResponse<Response>();
    const status = exception.getStatus();
    const message: string | object = exception.getResponse();
    response
      .status(status)
      .json(typeof message === 'object' ? { ...message } : { message });
  }
}
Example #17
Source File: user.service.ts    From Phantom with MIT License 6 votes vote down vote up
/**
   * @author Aya Abohadima <[email protected]>
   * @description change user password
   * @param {String} userId - user id
   * @param {String} newPassword - new password of user
   * @param {String} oldPassword - old password of user
   * @returns {Number} 1
   */
  async resetPassword(userId, newPassword, oldPassword) {
    const user = await this.findUserAndGetData(
      { _id: userId },
      { email: 1, password: 1, _id: 1, fristName: 1 },
    );
    if (!user || !newPassword)
      throw new HttpException('there is no new password', HttpStatus.FORBIDDEN);
    if (oldPassword) {
      if (!(await bcrypt.compare(oldPassword, user.password))) {
        throw new HttpException(
          'old password is not correct',
          HttpStatus.FORBIDDEN,
        );
      }
    }
    const salt = await bcrypt.genSalt(10);
    let hash = await bcrypt.hash(newPassword, salt);
    user.password = hash;
    await this.userModel.updateOne({ _id: userId }, { password: hash });
    return 1;
  }
Example #18
Source File: http-exception.filter.ts    From aqualink-app with MIT License 6 votes vote down vote up
@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
  private readonly logger = new Logger(HttpExceptionFilter.name);
  catch(exception: HttpException, host: ArgumentsHost) {
    const ctx = host.switchToHttp();
    const response = ctx.getResponse();

    this.logger.error(
      `An error has occurred: ${exception.message}`,
      exception.stack,
    );
    response.status(exception.getStatus()).json(exception.getResponse());
  }
}
Example #19
Source File: GqlResolverExceptions.filter.ts    From amplication with Apache License 2.0 6 votes vote down vote up
catch(exception: Error, host: ArgumentsHost): Error {
    const requestData = this.prepareRequestData(host);
    let clientError: Error;
    /**@todo: Complete the list or expected error codes */
    if (
      exception instanceof Prisma.PrismaClientKnownRequestError &&
      exception.code === PRISMA_CODE_UNIQUE_KEY_VIOLATION
    ) {
      // Convert PrismaClientKnownRequestError to UniqueKeyException and pass the error to the client
      const fields = (exception.meta as { target: string[] }).target;
      clientError = new UniqueKeyException(fields);
      this.logger.info(clientError.message, { requestData });
    } else if (exception instanceof AmplicationError) {
      // Convert AmplicationError to ApolloError and pass the error to the client
      clientError = new ApolloError(exception.message);
      this.logger.info(clientError.message, { requestData });
    } else if (exception instanceof HttpException) {
      // Return HTTP Exceptions to the client
      clientError = exception;
      this.logger.info(clientError.message, { requestData });
    } else {
      // Log the original exception and return a generic server error to client
      // eslint-disable-next-line
      // @ts-ignore
      exception.requestData = requestData;
      this.logger.error(exception);
      clientError =
        this.configService.get('NODE_ENV') === 'production'
          ? new InternalServerError()
          : new ApolloError(exception.message);
    }

    return clientError;
  }
Example #20
Source File: invalid-publisher.exception.ts    From nestjs-geteventstore with MIT License 6 votes vote down vote up
export class InvalidPublisherException<
  T extends object = Function
> extends HttpException {
  constructor(publisher: T, method: keyof T) {
    super(
      `Invalid publisher: expected ${
        publisher.constructor.name + '::' + method
      } to be a function`,
      HttpStatus.INTERNAL_SERVER_ERROR,
    );
  }
}
Example #21
Source File: theme.service.ts    From Cromwell with MIT License 6 votes vote down vote up
private async deleteTheme(themeName: string): Promise<boolean> {
        const pckgOld = await getModulePackage(themeName);
        const oldVersion = pckgOld?.version;
        if (!themeName || !oldVersion) throw new HttpException('Plugin package not found', HttpStatus.INTERNAL_SERVER_ERROR);

        await runShellCommand(`yarn remove ${themeName} --non-interactive`);
        await sleep(1);

        const pckgNew = await getModulePackage(themeName);
        if (pckgNew) throw new HttpException(`Failed to remove theme's package`, HttpStatus.INTERNAL_SERVER_ERROR);

        const themeRepo = getCustomRepository(GenericTheme.repository);
        const entity = await this.findOne(themeName);
        if (entity?.id) await themeRepo.deleteEntity(entity.id);

        await serverFireAction('uninstall_theme', { themeName });
        return true;
    }
Example #22
Source File: auth.guard.ts    From postgres-nest-react-typescript-boilerplate with GNU General Public License v3.0 6 votes vote down vote up
private verifyToken = async (auth: string) => {
    const authHeader = auth.split(' ');
    if (authHeader[0] !== 'Bearer') {
      throw new HttpException('Unauthorized token', HttpStatus.UNAUTHORIZED);
    }
    try {
      const token = authHeader[1];
      const decode = await verify(token, process.env.SECRET);
      return decode;
    } catch (err) {
      const message = 'Token error: ' + (err.message || err.name);
      throw new HttpException(message, HttpStatus.UNAUTHORIZED);
    }
  };
Example #23
Source File: theme.service.ts    From Cromwell with MIT License 6 votes vote down vote up
async handleThemeUpdate(themeName: string): Promise<boolean> {
        if (await this.cmsService.getIsRunningNpm()) {
            throw new HttpException('Only one install/update available at the time', HttpStatus.METHOD_NOT_ALLOWED);
        }
        await this.cmsService.setIsRunningNpm(true);
        await this.cmsService.checkYarn();

        const transactionId = getRandStr(8);
        startTransaction(transactionId);

        let success = false;
        let error: any;
        try {
            success = await this.updateTheme(themeName)
        } catch (e) {
            error = e;
            success = false;
        }

        if (success) await this.cmsService.installModuleDependencies(themeName);

        endTransaction(transactionId);
        await this.cmsService.setIsRunningNpm(false);

        if (!success) {
            throw new HttpException(error?.message, error?.status);
        }
        return true;
    }
Example #24
Source File: http-error.filter.ts    From postgres-nest-react-typescript-boilerplate with GNU General Public License v3.0 6 votes vote down vote up
catch(exception: HttpException, host: ArgumentsHost) {
    const ctx = host.switchToHttp();
    const response = ctx.getResponse();
    const request = ctx.getRequest();
    const status = exception.getStatus();

    const errorResponse = {
      statusCode: status,
      timestamp: new Date().toLocaleString(),
      path: request.url,
      method: request.method,
      message:
        status !== HttpStatus.INTERNAL_SERVER_ERROR
          ? exception.message || null
          : 'Internal server error',
    };

    if (status === HttpStatus.INTERNAL_SERVER_ERROR) {
      Logger.error(
        `${request.method} ${request.url}`,
        exception.stack,
        'ExceptionFilter',
      );
    } else {
      Logger.error(
        `${request.method} ${request.url}`,
        JSON.stringify(errorResponse),
        'ExceptionFilter',
      );
    }

    response.status(status).json(errorResponse);
  }
Example #25
Source File: theme.service.ts    From Cromwell with MIT License 6 votes vote down vote up
public async setActive(themeName: string): Promise<boolean> {
        const entity = await getCmsEntity();
        if (!entity) throw new HttpException('!cms entity', HttpStatus.INTERNAL_SERVER_ERROR);

        entity.publicSettings = {
            ...(entity.publicSettings ?? {}),
            themeName,
        }
        await entity.save();
        await restartService('renderer');

        const cmsSettings = getStoreItem('cmsSettings');
        const timeout = (cmsSettings?.watchPoll ?? 2000) + 1000;
        await new Promise(done => setTimeout(done, timeout));
        return true;
    }
Example #26
Source File: validation.pipe.ts    From postgres-nest-react-typescript-boilerplate with GNU General Public License v3.0 6 votes vote down vote up
async transform(value: any, { metatype }: ArgumentMetadata) {
    if (!metatype || !this.toValidate(metatype)) {
      return value;
    }
    const object = plainToClass(metatype, value);
    const errors = await validate(object);
    if (errors.length) {
      console.log(this.formatErrors(errors));
      throw new HttpException(
        `Validation error :  ${this.formatErrors(errors)}`,
        HttpStatus.BAD_REQUEST,
      );
    }
    return value;
  }
Example #27
Source File: store.service.ts    From Cromwell with MIT License 6 votes vote down vote up
async createPaymentSession(input: CreateOrderDto): Promise<OrderTotalDto> {
        const total = await this.calcOrderTotal(input);
        total.cart = total.cart?.filter(item => item?.product);

        if (!total.cart?.length) throw new HttpException('Cart is invalid or empty', HttpStatus.BAD_REQUEST);
        const settings = await getCmsSettings();

        const payments = await serverFireAction('create_payment', total);
        total.paymentOptions = [...Object.values(payments ?? {}),
        ...(!settings?.disablePayLater ? [
            payLaterOption,
        ] : []),];

        return total;
    }
Example #28
Source File: todo.service.ts    From postgres-nest-react-typescript-boilerplate with GNU General Public License v3.0 6 votes vote down vote up
updateTodo = async (
    userId: string,
    id: string,
    data: Partial<TodoDTO>,
  ): Promise<TodoSO> => {
    const todo = await this.todoRepository.findOne(
      { id },
      { relations: ['author'] },
    );

    if (!todo) throw new HttpException('Item not found', HttpStatus.NOT_FOUND);
    this.verifyOwnership(todo, userId);

    if (data.hasOwnProperty('completed')) {
      await this.todoRepository.update({ id }, { completed: data.completed });
    }
    if (data.content) {
      await this.todoRepository.update({ id }, { content: data.content });
    }

    return this.responseOject(todo);
  };
Example #29
Source File: plugin.service.ts    From Cromwell with MIT License 6 votes vote down vote up
async installPlugin(pluginName: string): Promise<boolean> {
        const info = await this.getPluginLatest(pluginName);
        if (!pluginName || !info || !info.packageVersion || !info.version) throw new HttpException('Plugin was not found', HttpStatus.METHOD_NOT_ALLOWED);

        const settings = await getCmsSettings();
        const isBeta = !!settings?.beta;
        const version = isBeta ? (info.betaVersion ?? info.version) : info.version;

        await runShellCommand(`yarn add ${pluginName}@${version} --exact --non-interactive`);
        await sleep(1);

        const pluginPckgNew = await getModulePackage(pluginName);
        if (!pluginPckgNew?.version) throw new HttpException('Plugin package was not found', HttpStatus.INTERNAL_SERVER_ERROR);

        const pluginExports = (await readPluginsExports()).find(p => p.pluginName === pluginName);
        if (!pluginExports) throw new HttpException('Plugin in not a CMS module', HttpStatus.INTERNAL_SERVER_ERROR);

        if (pluginExports.backendPath && await fs.pathExists(pluginExports.backendPath)) {
            // If plugin has backend, we need to apply it by restarting API server
            // Using "Safe reload" will switch to a new server only if it successfully started:
            const resp1 = await childSendMessage('make-new');
            if (resp1.message !== 'success') {
                // Rollback
                await runShellCommand(`yarn remove ${pluginName} --non-interactive`);
                await sleep(1);

                throw new HttpException('Could not start server with the new plugin', HttpStatus.INTERNAL_SERVER_ERROR);
            } else {
                const resp2 = await childSendMessage('apply-new', resp1.payload);

                if (resp2.message !== 'success') throw new HttpException('Could not start server with the new plugin', HttpStatus.INTERNAL_SERVER_ERROR);

                setPendingKill(2000);
            }
        }

        await this.activatePlugin(pluginName);
        return true;
    }