How to use the http-status.NOT_IMPLEMENTED function in http-status

To help you get started, we’ve selected a few http-status examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentralized-identity / hub-node-core / lib / controllers / CollectionsController.ts View on Github external
async handleExecuteRequest(request: HubRequest): Promise {
    throw new HubError(`${request.getAction()} handler not implemented.`, HttpStatus.NOT_IMPLEMENTED);
  }
github IBM / taxinomitis / src / lib / restapi / errors.ts View on Github external
export function notImplemented(res: Express.Response) {
    return res.status(httpstatus.NOT_IMPLEMENTED).json({ error : 'Not implemented' });
}
export function unknownError(res: Express.Response, err: NodeJS.ErrnoException | any) {
github IBM / taxinomitis / src / lib / restapi / scratch.ts View on Github external
async function trainNewClassifier(req: Express.Request, res: Express.Response) {
    const apikey = req.params.scratchkey;

    try {
        const scratchKey = await store.getScratchKey(apikey);
        const classifierStatus = await models.trainModel(scratchKey);

        return res.set(headers.NO_CACHE).jsonp(classifierStatus);
    }
    catch (err) {
        if (err.message === 'Only text or numbers models can be trained using a Scratch key') {
            return res.status(httpstatus.NOT_IMPLEMENTED).json({ error : err.message });
        }

        log.error({ err, agent : req.header('X-User-Agent') }, 'Train error');
        errors.unknownError(res, err);
    }
}