How to use the fumble.http function in fumble

To help you get started, we’ve selected a few fumble 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 yahoo / fetchr / libs / fetcher.js View on Github external
return function (req, res, next) {
        var request;
        var error;
        var serviceMeta;

        if (req.method === GET) {
            var path = req.path.substr(1).split(';');
            var resource = path.shift();

            if (!Fetcher.isRegistered(resource)) {
                error = fumble.http.badRequest('Invalid Fetchr Access', {
                    debug: 'Bad resource ' + sanitizeResourceName(resource)
                });
                error.source = 'fetchr';
                return next(error);
            }
            serviceMeta = [];
            request = new Request(OP_READ, resource, {
                req: req,
                serviceMeta: serviceMeta,
                statsCollector: options.statsCollector,
                paramsProcessor: options.paramsProcessor
            });
            request
                .params(parseParamValues(qs.parse(path.join('&'))))
                .end(function (err, data) {
                    var meta = serviceMeta[0] || {};
github slidewiki / slidewiki-platform / actions / error / gatewayTimeoutError.js View on Github external
export default function gatewayTimeoutError(context, payload, done) {
    log.error(context,  'Gateway timeout');
    const error = fumble.http.badRequest();
    ErrorsList.GATEWAY_TIMEOUT_ERROR.statusCode = error.statusCode;
    ErrorsList.GATEWAY_TIMEOUT_ERROR.statusText = error.message;
    context.dispatch('GATEWAY_TIMEOUT_ERROR', ErrorsList.GATEWAY_TIMEOUT_ERROR);
    done(error);
}
github slidewiki / slidewiki-platform / actions / error / deckContentTypeError.js View on Github external
export default function deckContentTypeError(context, payload, done) {
    log.error(context, {deck_id: payload.params.id, stype:payload.params.stype, text: 'Invalid deck content type'});
    const error = fumble.http.badRequest();
    ErrorsList.DECK_CONTENT_TYPE_ERROR.statusCode = error.statusCode;
    ErrorsList.DECK_CONTENT_TYPE_ERROR.statusText = error.message;
    context.dispatch('DECK_CONTENT_TYPE_ERROR', ErrorsList.DECK_CONTENT_TYPE_ERROR);
    done(error);
}
github slidewiki / slidewiki-platform / actions / error / deckContentPathError.js View on Github external
export default function deckContentPathError(context, payload, done) {
    log.error(context, {deck_id: payload.params.id, spath: payload.params.spath, text: 'Invalid deck content path'});
    const error = fumble.http.badRequest();
    ErrorsList.DECK_CONTENT_TYPE_ERROR.statusCode = error.statusCode;
    ErrorsList.DECK_CONTENT_TYPE_ERROR.statusText = error.message;
    context.dispatch('DECK_CONTENT_TYPE_ERROR', ErrorsList.DECK_CONTENT_TYPE_ERROR);
    done(error);
}
github slidewiki / slidewiki-platform / actions / error / tooManyRequestsError.js View on Github external
export default function tooManyRequestsError(context, payload, done) {
    log.error(context,  'Too many requests');
    const error = fumble.http.tooManyRequests();
    ErrorsList.TOO_MANY_REQUESTS_ERROR.statusCode = error.statusCode;
    ErrorsList.TOO_MANY_REQUESTS_ERROR.statusText = error.message;
    context.dispatch('TOO_MANY_REQUESTS_ERROR', ErrorsList.TOO_MANY_REQUESTS_ERROR);
    done(error);
}
github slidewiki / slidewiki-platform / actions / error / searchSyntaxError.js View on Github external
export default function searchSyntaxError(context, payload, done) {
    log.error(context,  'Search syntax error');
    const error = fumble.http.badRequest();
    ErrorsList.SEARCH_SYNTAX_ERROR.statusCode = error.statusCode;
    ErrorsList.SEARCH_SYNTAX_ERROR.statusText = error.message;
    context.dispatch('SEARCH_SYNTAX_ERROR', ErrorsList.SEARCH_SYNTAX_ERROR);
    done(error);
}
github slidewiki / slidewiki-platform / actions / error / methodNotAllowedError.js View on Github external
export default function methodNotAllowedError(context, payload, done) {
    log.error(context,  'Method not allowed');
    const error = fumble.http.methodNotAllowed();
    ErrorsList.METHOD_NOT_ALLOWED_ERROR.statusCode = error.statusCode;
    ErrorsList.METHOD_NOT_ALLOWED_ERROR.statusText = error.message;
    context.dispatch('METHOD_NOT_ALLOWED_ERROR', ErrorsList.METHOD_NOT_ALLOWED_ERROR);
    done(error);
}
github slidewiki / slidewiki-platform / actions / error / deckIdTypeError.js View on Github external
export default function deckIdTypeError(context, payload, done) {
    log.error(context, {deck_id: payload.params.id, text: 'Invalid deck id'});
    const error = fumble.http.badRequest();
    ErrorsList.DECK_ID_TYPE_ERROR.statusCode = error.statusCode;
    ErrorsList.DECK_ID_TYPE_ERROR.statusText = error.message;
    context.dispatch('TOO_MANY_REQUESTS_ERROR', ErrorsList.DECK_ID_TYPE_ERROR);
    done(error);
}
github recruit-tech / redux-pluto / src / server / services / utils.js View on Github external
error => {
      if (error.response) {
        return rejectWith(fumble.http.create(error.response.status), {
          name,
          formattedUrl,
          reason: error.response.data
        });
      }
      return rejectWith(fumble.http.create(500), {
        name,
        formattedUrl,
        reason: error.message
      });
    }
  );
github slidewiki / slidewiki-platform / actions / error / slideIdTypeError.js View on Github external
export default function slideIdTypeError(context, payload, done) {
    log.error(context,  'Invalid slide id');
    const error = fumble.http.badRequest();
    ErrorsList.SLIDE_ID_TYPE_ERROR.statusCode = error.statusCode;
    ErrorsList.SLIDE_ID_TYPE_ERROR.statusText = error.message;
    context.dispatch('SLIDE_ID_TYPE_ERROR', ErrorsList.SLIDE_ID_TYPE_ERROR);
    done(error);
}

fumble

Simple error objects in node. Created specifically to be used with the fetchr library and based on hapi.js' Boom.

Unknown
Latest version published 3 years ago

Package Health Score

43 / 100
Full package analysis

Popular fumble functions