aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/utils/decorators.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src/utils/decorators.ts')
-rw-r--r--packages/0x.js/src/utils/decorators.ts21
1 files changed, 13 insertions, 8 deletions
diff --git a/packages/0x.js/src/utils/decorators.ts b/packages/0x.js/src/utils/decorators.ts
index 2a823b9ac..99c7cce39 100644
--- a/packages/0x.js/src/utils/decorators.ts
+++ b/packages/0x.js/src/utils/decorators.ts
@@ -1,8 +1,8 @@
import * as _ from 'lodash';
-import {AsyncMethod, SyncMethod, ZeroExError} from '../types';
+import { AsyncMethod, SyncMethod, ZeroExError } from '../types';
-import {constants} from './constants';
+import { constants } from './constants';
type ErrorTransformer = (err: Error) => Error;
@@ -19,7 +19,8 @@ const contractCallErrorTransformer = (error: Error) => {
const schemaErrorTransformer = (error: Error) => {
if (_.includes(error.message, constants.INVALID_TAKER_FORMAT)) {
// tslint:disable-next-line:max-line-length
- const errMsg = 'Order taker must be of type string. If you want anyone to be able to fill an order - pass ZeroEx.NULL_ADDRESS';
+ const errMsg =
+ 'Order taker must be of type string. If you want anyone to be able to fill an order - pass ZeroEx.NULL_ADDRESS';
return new Error(errMsg);
}
return error;
@@ -30,14 +31,16 @@ const schemaErrorTransformer = (error: Error) => {
*/
const asyncErrorHandlerFactory = (errorTransformer: ErrorTransformer) => {
const asyncErrorHandlingDecorator = (
- target: object, key: string|symbol, descriptor: TypedPropertyDescriptor<AsyncMethod>,
+ target: object,
+ key: string | symbol,
+ descriptor: TypedPropertyDescriptor<AsyncMethod>,
) => {
- const originalMethod = (descriptor.value as AsyncMethod);
+ const originalMethod = descriptor.value as AsyncMethod;
// Do not use arrow syntax here. Use a function expression in
// order to use the correct value of `this` in this method
// tslint:disable-next-line:only-arrow-functions
- descriptor.value = async function(...args: any[]) {
+ descriptor.value = async function(...args: any[]) {
try {
const result = await originalMethod.apply(this, args);
return result;
@@ -55,9 +58,11 @@ const asyncErrorHandlerFactory = (errorTransformer: ErrorTransformer) => {
const syncErrorHandlerFactory = (errorTransformer: ErrorTransformer) => {
const syncErrorHandlingDecorator = (
- target: object, key: string|symbol, descriptor: TypedPropertyDescriptor<SyncMethod>,
+ target: object,
+ key: string | symbol,
+ descriptor: TypedPropertyDescriptor<SyncMethod>,
) => {
- const originalMethod = (descriptor.value as SyncMethod);
+ const originalMethod = descriptor.value as SyncMethod;
// Do not use arrow syntax here. Use a function expression in
// order to use the correct value of `this` in this method