How to use the @marblejs/core.HttpStatus.BAD_REQUEST function in @marblejs/core

To help you get started, we’ve selected a few @marblejs/core 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 marblejs / marble / packages / middleware-joi / src / joi.middleware.ts View on Github external
catchError((err: Error) =>
          throwError(new HttpError(err.message, HttpStatus.BAD_REQUEST))
        ),
github marblejs / marble / packages / middleware-io / src / io.request.middleware.ts View on Github external
catchError((error: IOError) => throwError(
          new HttpError(error.message, HttpStatus.BAD_REQUEST, error.data, error.context),
        )),
      )
github marblejs / marble / packages / middleware-io / src / specs / io.request.middleware.spec.ts View on Github external
(error: HttpError) => {
        expect(error.message).toEqual('Validation error');
        expect(error.status).toEqual(HttpStatus.BAD_REQUEST);
        expect(error.context).toEqual('headers');
        expect(error.data).toEqual([
          {
            expected: '"application/json"',
            got: '"text/plain"',
            path: 'content-type',
          }
        ]);
        done();
      },
    );
github marblejs / marble / packages / middleware-body / src / body.middleware.ts View on Github external
catchError(() => throwError(
          new HttpError('Request body parse error', HttpStatus.BAD_REQUEST),
        ))
      ),
github marblejs / marble / packages / middleware-joi / src / validator.middleware.ts View on Github external
catchError((err: Joi.ValidationError) => {
            const message = err.details[0].message;
            return throwError(new HttpError(message, HttpStatus.BAD_REQUEST));
          })
        )