当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Boom.badImplementation函数代码示例

本文整理汇总了TypeScript中Boom.badImplementation函数的典型用法代码示例。如果您正苦于以下问题:TypeScript badImplementation函数的具体用法?TypeScript badImplementation怎么用?TypeScript badImplementation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了badImplementation函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: async

  const createNewIndex = async (reindexOp: ReindexSavedObject) => {
    const { indexName, newIndexName } = reindexOp.attributes;

    const flatSettings = await actions.getFlatSettings(indexName);
    if (!flatSettings) {
      throw Boom.notFound(`Index ${indexName} does not exist.`);
    }

    const { settings, mappings } = transformFlatSettings(flatSettings);

    const createIndex = await callCluster('indices.create', {
      index: newIndexName,
      body: {
        settings,
        mappings,
      },
    });

    if (!createIndex.acknowledged) {
      throw Boom.badImplementation(`Index could not be created: ${newIndexName}`);
    }

    return actions.updateReindexOp(reindexOp, {
      lastCompletedStep: ReindexStep.newIndexCreated,
    });
  };
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: createUser

 public async createUser(request: Hapi.Request, reply: Hapi.ReplyNoContinue) {
     try {
         let user: any = await this.database.userModel.create(request.payload);
         return reply({ token: this.generateToken(user)}).code(201);
     } catch (error) {
         return reply(Boom.badImplementation(error));
     }
 }
开发者ID:mlinuxgada,项目名称:hapi-typescript-example,代码行数:8,代码来源:user-controller.ts

示例3: checkAndSendSchema

export function checkAndSendSchema(object: any, schema: j.AnySchema<any>, log: any, reply: h.IReply) {
	let err;
	if(err = j.validate(object, schema).error) {
		log.error(err);
		reply(b.badImplementation())
	} else {
		reply(object);
	}
}
开发者ID:JosephCaillet,项目名称:cozy-vinimay,代码行数:9,代码来源:commons.ts

示例4: updateUser

    public async updateUser(request: Hapi.Request, reply: Hapi.ReplyNoContinue) {
        const id = request.auth.credentials.id;

        try {
            let  user: IUser = await this.database.userModel.findByIdAndUpdate(id, { $set: request.payload }, { new: true });
            return reply(user);
        } catch (error) {
            return reply(Boom.badImplementation(error));
        }
    }
开发者ID:mlinuxgada,项目名称:hapi-typescript-example,代码行数:10,代码来源:user-controller.ts

示例5: if

 .then(status => {
   if (status.code >= 400 && status.code < 500) {
     throw boom.badRequest(status.message);
   } else if (status.code >= 500) {
     throw boom.badImplementation(status.message);
   }
   res.json({
     success: true,
   });
 })
开发者ID:ericmasiello,项目名称:synbydesign,代码行数:10,代码来源:likeControllers.ts

示例6: reply

 .catch(function (err) {
   if (err.isBoom) {
     reply(err);
   } else if (err.statusCode != null) {
     reply(err).code(err.statusCode);
   } else {
     reply(Boom.badImplementation(err.message || err, err));
   }
   if (profile) console.timeEnd(request.path + " handler");
   if (profile) console.timeEnd(request.path + " overall");
 })
开发者ID:UnwrittenFun,项目名称:strictly-hapi,代码行数:11,代码来源:bootstrap.ts

示例7: async

 handler: async (request, reply) => {
     try {
         const canvas: Canvas = await db.getCanvas(request.params.id);
         if (!canvas) {
             reply(Boom.notFound());
         }
         reply(canvas);
     } catch (error) {
         logger.error(error);
         reply(Boom.badImplementation());
     }
 }
开发者ID:cschram,项目名称:drawgaiden,代码行数:12,代码来源:canvas.ts

示例8: createTask

    public async createTask(request: Hapi.Request, reply: Hapi.ReplyNoContinue) {
        let userId = request.auth.credentials.id;
        var newTask: ITask = request.payload;
        newTask.userId = userId;

        try {
            let task: ITask = await this.database.taskModel.create(newTask);
            return reply(task).code(201);
        } catch (error) {
            return reply(Boom.badImplementation(error));
        }
    }
开发者ID:mlinuxgada,项目名称:hapi-typescript-example,代码行数:12,代码来源:task-controller.ts


注:本文中的Boom.badImplementation函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。