Initial commit
This commit is contained in:
commit
f47e08fdcb
2409 files changed
+363607
No files matched your search
+41
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.formatError = formatError;
|
||||
|
||||
var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* strict
|
||||
*/
|
||||
|
||||
/**
|
||||
* Given a GraphQLError, format it according to the rules described by the
|
||||
* Response Format, Errors section of the GraphQL Specification.
|
||||
*/
|
||||
function formatError(error) {
|
||||
!error ? (0, _invariant.default)(0, 'Received null or undefined error.') : void 0;
|
||||
var message = error.message || 'An unknown error occurred.';
|
||||
var locations = error.locations;
|
||||
var path = error.path;
|
||||
var extensions = error.extensions;
|
||||
return extensions ? {
|
||||
message: message,
|
||||
locations: locations,
|
||||
path: path,
|
||||
extensions: extensions
|
||||
} : {
|
||||
message: message,
|
||||
locations: locations,
|
||||
path: path
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user