Skip to content

Commit

Permalink
no error tests
Browse files Browse the repository at this point in the history
  • Loading branch information
omreego committed Jan 9, 2024
1 parent 05db435 commit 9dfaa51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
20 changes: 0 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/adapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as gql from 'graphql';
import {Maybe} from 'graphql/jsutils/Maybe';
import _ from 'lodash';
import {DateTime} from 'luxon';
import {singular} from 'pluralize';
Expand Down Expand Up @@ -305,7 +306,8 @@ export function asV2AST(ast: gql.ASTNode, typeInfo: gql.TypeInfo): gql.ASTNode {
export class QueryAdapter {
constructor(
private readonly faros: FarosClient,
private readonly v1Schema: gql.GraphQLSchema
private readonly v1Schema: gql.GraphQLSchema,
private readonly v2Schema: Maybe<gql.GraphQLSchema> = undefined
) {
if (faros.graphVersion !== 'v2') {
throw new VError(
Expand Down Expand Up @@ -427,7 +429,7 @@ export class QueryAdapter {
const v1TypeInfo = new gql.TypeInfo(this.v1Schema);
const nodePaths = this.nodePaths(v1AST, v1TypeInfo);
let v2Query: string;
if (validationErrors.length > 0) {
if (this.v2Schema && validationErrors.length > 0) {
const v2ValidationErrors = gql.validate(this.v2Schema, v1AST);
if (v2ValidationErrors.length > 0) {
throw new VError(
Expand Down
2 changes: 1 addition & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function wrapApiError(maybeError: Error, message?: string): Error {
}

const prefix = message ? `${message}: ` : '';
const res: AxiosResponse<any, any> | undefined = error.response;
const res: AxiosResponse<any> | undefined = error.response;
const info = {
req:
error.config || error.request
Expand Down

0 comments on commit 9dfaa51

Please sign in to comment.