swc/bundler/tests/.cache/deno/fcf896e3589f50e963c2723a443b9cca9dc5538e.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

19 lines
727 B
TypeScript

// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/error/locatedError.js
import { GraphQLError } from './GraphQLError.js';
/**
* Given an arbitrary Error, presumably thrown while attempting to execute a
* GraphQL operation, produce a new GraphQLError aware of the location in the
* document responsible for the original Error.
*/
export function locatedError(originalError, nodes, path) {
// Note: this uses a brand-check to support GraphQL errors originating from
// other contexts.
if (Array.isArray(originalError.path)) {
return originalError;
}
return new GraphQLError(originalError.message, originalError.nodes ?? nodes, originalError.source, originalError.positions, path, originalError);
}