@vue/apollo-util
Advanced tools
Comparing version 4.0.0-alpha.11 to 4.0.0-alpha.13
@@ -1,2 +0,4 @@ | ||
export declare function getErrorMessages(error: any): string[]; | ||
export declare function logErrorMessages(error: any, printStack?: boolean): void; | ||
import { ApolloError } from '@apollo/client/core'; | ||
import { ErrorResponse } from '@apollo/client/link/error'; | ||
export declare function getErrorMessages(error: ErrorResponse | ApolloError): string[]; | ||
export declare function logErrorMessages(error: ApolloError | ErrorResponse, printStack?: boolean): void; |
@@ -7,3 +7,5 @@ "use strict"; | ||
var messages = []; | ||
var graphQLErrors = error.graphQLErrors, networkError = error.networkError, operation = error.operation, stack = error.stack; | ||
var graphQLErrors = error.graphQLErrors, networkError = error.networkError; | ||
var operation = 'operation' in error ? error.operation : undefined; | ||
var stack = 'stack' in error ? error.stack : undefined; | ||
var printedQuery; | ||
@@ -34,3 +36,3 @@ if (operation) { | ||
if (printStack === void 0) { printStack = true; } | ||
getErrorMessages(error).map(function (message) { | ||
getErrorMessages(error).forEach(function (message) { | ||
var result = /\[([\w ]*)](.*)/.exec(message); | ||
@@ -47,2 +49,4 @@ if (result) { | ||
var stack = new Error().stack; | ||
if (stack == null) | ||
return; | ||
var newLineIndex = stack.indexOf('\n'); | ||
@@ -62,9 +66,11 @@ stack = stack.substr(stack.indexOf('\n', newLineIndex + 1)); | ||
} | ||
for (var _i = 0, locations_1 = locations; _i < locations_1.length; _i++) { | ||
var _a = locations_1[_i], line = _a.line, column = _a.column; | ||
var index = lineMap[line]; | ||
result.splice(index, 0, '▲'.padStart(column, ' ')); | ||
// Offset remaining lines | ||
for (var i = index + 1; i < l; i++) { | ||
lineMap[i]++; | ||
if (locations) { | ||
for (var _i = 0, locations_1 = locations; _i < locations_1.length; _i++) { | ||
var _a = locations_1[_i], line = _a.line, column = _a.column; | ||
var index = lineMap[line]; | ||
result.splice(index, 0, '▲'.padStart(column, ' ')); | ||
// Offset remaining lines | ||
for (var i = index + 1; i < l; i++) { | ||
lineMap[i]++; | ||
} | ||
} | ||
@@ -71,0 +77,0 @@ } |
{ | ||
"name": "@vue/apollo-util", | ||
"version": "4.0.0-alpha.11", | ||
"version": "4.0.0-alpha.13", | ||
"description": "Apollo GraphQL for Vue - Utilities", | ||
@@ -37,3 +37,3 @@ "repository": { | ||
}, | ||
"gitHead": "01d164768820390e9fd8db27ef60d23c9c8fbb0e" | ||
"gitHead": "60e7ee3b24ad95ca04eeb65c86b914f6407b623d" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8611
93