Skip to content

Commit

Permalink
Move errors & export them (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
klesgidis authored Jan 17, 2022
1 parent d63507d commit 16998a9
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/errors/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { AxiosError } from './axios-error';
export { CustomError } from './custom-error';
export { ValidationError } from './validation-error';
File renamed without changes.
2 changes: 1 addition & 1 deletion src/helpers/interceptors/axios-error-interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import requireInjected from '../../require-injected';
import { AxiosError } from '../../middlewares/errors/axios-error';
import { AxiosError } from '../../errors/axios-error';

export default () => {
const axios = requireInjected('axios');
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Orka from './orka';
import * as middlewares from './middlewares';
import * as helpers from './helpers';
import * as errors from './errors';

export { default as builder, getRequestContext, runWithContext } from './builder';
export { getLogger } from './initializers/log4js';
Expand All @@ -14,4 +15,4 @@ export { getRedis, createRedisConnection } from './initializers/redis';
export { getBull } from './initializers/bull';
export { getPrometheus } from './initializers/prometheus';
export { getPostgresPool, withPostgresTransaction } from './initializers/postgres';
export { middlewares, helpers };
export { middlewares, helpers, errors };
2 changes: 1 addition & 1 deletion src/initializers/log4js/json-appender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const createValidLog = (layout, logEvent, config) => {
timestamp: logEvent.startTime,
severity: logEvent.level.levelStr,
categoryName: logEvent.categoryName,
message,
message: message,
context
};
};
Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/validate-params.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Joi from '@hapi/joi';
import { ValidationError } from './errors/validation-error';
import { ValidationError } from '../errors/validation-error';
import * as Koa from 'koa';

function validate(body: any, schema: Joi.ObjectSchema) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as _axios from 'axios';
import snapshot = require('snap-shot-it');
import * as util from 'util';
import { AxiosError } from '../../../../src/middlewares/errors/axios-error';
import { AxiosError } from '../../src/errors/axios-error';
import * as sinon from 'sinon';

const sandbox = sinon.createSandbox();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'should';
import * as sinon from 'sinon';
import { CustomError } from '../../../../src/middlewares/errors/custom-error';
import { CustomError } from '../../src/errors/custom-error';

const sandbox = sinon.createSandbox();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'should';
import * as sinon from 'sinon';
import { ValidationError } from '../../../../src/middlewares/errors/validation-error';
import { ValidationError } from '../../src/errors/validation-error';

const sandbox = sinon.createSandbox();

Expand Down

0 comments on commit 16998a9

Please sign in to comment.