ErrorList: ErrorList

Description Usage Initialize Details Examples

Description

Handles all errors that occur during query validation. This object is returned from execute request function (ans <- execute_request(query, schema)) under the field 'error_list' (ans$error_list).

Usage

1
2
answer <- execute_request(my_request, my_schema)
answer$error_list

Initialize

verbose

boolean that determines if errors will be printed on occurrence. Defaults to TRUE

Details

$n count of errors received

$errors list of error information

$verbose boolean that determines of errors are printed when received

$has_no_errors() helper method to determine if there are no errors

$has_any_errors() helper method to determine if there are any errors

$get_sub_source(loc) helper method to display a subsection of source text given Location information

$add(rule_code, ...) add a new error according to the rule_code provided. Remaining arguments are passed directly to paste(..., sep = "") with extra error rule information

$.format(...) formats the error list into user friendly text. Remaining arguments are ignored

$print(...) prints the error list by calling self$format(...)

Examples

1
2
3
4
5
6
7
8
9
error_list <- ErrorList$new()
error_list
error_list$has_any_errors() # FALSE
error_list$has_no_errors() # TRUE

error_list$add("3.1.1", "Multiple part", " error about Scalars")
error_list
error_list$has_any_errors() # TRUE
error_list$has_no_errors() # FALSE

gqlr documentation built on Dec. 2, 2019, 5:07 p.m.