Skip to content

Commit

Permalink
fix(graphql-editor#314): added explicit runtime error
Browse files Browse the repository at this point in the history
  • Loading branch information
GauBen committed Jun 28, 2022
1 parent 59d55d8 commit 56a82da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/TreeToTS/functions/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ export const ResolveFromPath = (props: AllTypesPropsType, returns: ReturnTypesTy
const oKey = ops[mappedParts[0].v];
const returnP1 = oKey ? returns[oKey] : returns[mappedParts[0].v];
if (typeof returnP1 === 'object') {
if (!mappedParts[1]) throw new Error(\`\${mappedParts[0].v} does not take arguments\`);
const returnP2 = returnP1[mappedParts[1].v];
if (returnP2) {
return rpp(
Expand Down Expand Up @@ -601,6 +602,7 @@ export const InternalArgsBuilt = ({
const arb = (a: ZeusArgsType, p = '', root = true): string => {
const checkType = ResolveFromPath(props, returns, ops)(p);
if (checkType.startsWith('scalar.')) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_, ...splittedScalar] = checkType.split('.');
const scalarKey = splittedScalar.join('.');
return (scalars?.[scalarKey]?.encode?.(a) as string) || JSON.stringify(a);
Expand Down
1 change: 1 addition & 0 deletions src/TreeToTS/functions/new/resolvePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const ResolveFromPath = (props: AllTypesPropsType, returns: ReturnTypesTy
const oKey = ops[mappedParts[0].v];
const returnP1 = oKey ? returns[oKey] : returns[mappedParts[0].v];
if (typeof returnP1 === 'object') {
if (!mappedParts[1]) throw new Error(`${mappedParts[0].v} does not take arguments`);
const returnP2 = returnP1[mappedParts[1].v];
if (returnP2) {
return rpp(
Expand Down

0 comments on commit 56a82da

Please sign in to comment.