mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
19 lines
727 B
TypeScript
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);
|
|
} |