code: function createUserError(
    message: string,
    locations?: ?$ReadOnlyArray<Location>,
    nodes?: ?$ReadOnlyArray<ASTNode>,
  ): UserError {
    let messageWithLocations = message;
    if (locations != null) {
      const printedLocations = printLocations(locations);
      messageWithLocations =
        printedLocations.length === 0
          ? message
          : [message, ...printedLocations].join('\n\n') + '\n';
    }
    return new GraphQLError(messageWithLocations, nodes ?? []);
  }
docs: Creates an error describing invalid application code (GraphQL/Schema)
  that must be fixed by the end developer. This should only be used
  for local errors that don't affect processing of other user code.