How to use the typescript-rest.Errors.ForbidenError function in typescript-rest

To help you get started, we’ve selected a few typescript-rest 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 TreeGateway / tree-gateway / src / lib / admin / api / stats.ts View on Github external
return new Promise>>((resolve, reject) =>{
            let apiConfig = this.gateway.getApiConfig(apiId);
            
            if (!apiConfig) {
                return reject(new Errors.NotFoundError("API not found"));
            }
            if (path) {
                let stats = this.statsRecorder.createStats(Stats.getStatsKey(prefix, apiConfig.path, key))
                stats.getLastOccurrences(count||24, path, ...extra)
                .then(resolve)
                .catch(reject);
            }
            else {
                return reject(new Errors.ForbidenError("Path parameter is required."));
            }
        });
    }
github TreeGateway / tree-gateway / src / lib / admin / api / cors.ts View on Github external
.catch(err => {
                    throw new Errors.ForbidenError(JSON.stringify(err));
                })
                .then(() => this.service.update(apiId, corsId, cors))
github TreeGateway / tree-gateway / src / lib / admin / api / authentication.ts View on Github external
.catch(err => {
                    throw new Errors.ForbidenError(JSON.stringify(err));
                })
                .then(() => this.service.update(apiId, auth))
github TreeGateway / tree-gateway / src / lib / admin / api / throttling.ts View on Github external
.catch(err => {
                    throw new Errors.ForbidenError(JSON.stringify(err));
                })
                .then(() => this.service.create(apiId, throttling))
github TreeGateway / tree-gateway / src / lib / admin / api / proxy.ts View on Github external
.catch(err => {
                    throw new Errors.ForbidenError(JSON.stringify(err));
                })
                .then(() => this.service.update(apiId, proxy))
github TreeGateway / tree-gateway / src / lib / admin / api / circuit-breaker.ts View on Github external
.catch(err => {
                    throw new Errors.ForbidenError(JSON.stringify(err));
                })
                .then(() => this.service.update(apiId, circuitbreakerId, circuitbreaker))
github TreeGateway / tree-gateway / src / admin / api / stats.ts View on Github external
return new Promise>>((resolve, reject) => {
            if (path) {
                const stats = this.statsRecorder.createStats(Stats.getStatsKey(prefix, apiId, key));
                stats.getLastOccurrences(count || 24, normalizePath(path), ...extra)
                    .then(resolve)
                    .catch(reject);
            } else {
                return reject(new Errors.ForbidenError('Path parameter is required.'));
            }
        });
    }
github TreeGateway / tree-gateway / src / lib / admin / api / group.ts View on Github external
.catch(err => {
                    throw new Errors.ForbidenError(JSON.stringify(err));
                })
                .then(() => this.service.create(apiId, group))
github TreeGateway / tree-gateway / src / lib / admin / api / cache.ts View on Github external
.catch(err => {
                    throw new Errors.ForbidenError(JSON.stringify(err));
                })
                .then(() => this.service.create(apiId, cache))