Skip to content

Commit

Permalink
fix(transformers): Fix error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
parmentf committed Jul 23, 2021
1 parent fc2edef commit 7ade53d
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions packages/transformers/src/operations/transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const transformerWithArg = (func, name, value, args) => {
const arg = args.find(a => a.name === name);

if (!arg) {
throw new Error('Invalid Argument for ${name}');
throw new Error(`Invalid Argument for ${name}`);
}

return new Promise((resolve, reject) => {
Expand All @@ -36,7 +36,7 @@ export const transformerWithTwoArgs = (func, name1, name2, value, args) => {
const arg2 = args.find(a => a.name === name2);

if (!arg1 || !arg2) {
throw new Error('Invalid Argument for ${name1} or ${name2}');
throw new Error(`Invalid Argument for ${name1} or ${name2}`);
}

return new Promise((resolve, reject) => {
Expand All @@ -56,7 +56,7 @@ export const rawTransformerWithArg = (func, name, value, args) => {
const arg = args.find(a => a.name === name);

if (!arg) {
throw new Error('Invalid Argument for ${name}');
throw new Error(`Invalid Argument for ${name}`);
}

return new Promise((resolve, reject) => {
Expand All @@ -68,12 +68,10 @@ export const rawTransformerWithArg = (func, name, value, args) => {
});
};

export const rawTransformerWithoutArg = (func, value) => {
return new Promise((resolve, reject) => {
try {
resolve(func(value));
} catch (error) {
reject(error);
}
});
};
export const rawTransformerWithoutArg = (func, value) => new Promise((resolve, reject) => {
try {
resolve(func(value));
} catch (error) {
reject(error);
}
});

0 comments on commit 7ade53d

Please sign in to comment.