Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Return error code in case of an error #134

Closed
opomuc opened this issue Apr 25, 2018 · 6 comments
Closed

Return error code in case of an error #134

opomuc opened this issue Apr 25, 2018 · 6 comments
Labels
customer enhancement New feature or request prio1

Comments

@opomuc
Copy link

opomuc commented Apr 25, 2018

It would be great to handle errors from graphql accordingly by using error code. Currently is just asserts and returns error message

@Totktonada Totktonada added enhancement New feature or request customer labels Apr 25, 2018
@Totktonada
Copy link
Member

Totktonada commented Apr 28, 2018

Needed at least the following error codes:

  • variables don't fit well with a query

By the way I think that it should be okay to still use error(), but throw an object instead of a string.

@Totktonada Totktonada added this to the 0.0.1 milestone Apr 28, 2018
@opomuc
Copy link
Author

opomuc commented May 3, 2018

Add one to the list:

  • query execution timeout exceeded
Error catched: query execution timeout exceeded, use timeout_ms to increase it
Error occured at '/usr/share/tarantool/graphql/accessor_general.lua:869'

[C   ] function 'assert' at <[C]:-1>
[Lua ] function 'process_tuple' at </usr/share/tarantool/graphql/accessor_general.lua:869>
[Lua ] function 'select' at </usr/share/tarantool/graphql/accessor_general.lua:1037>
[Lua ] function 'defaultResolver' at </usr/share/tarantool/graphql/tarantool_graphql.lua:539>
[Lua ] function 'fn' at </usr/share/tarantool/graphql/core/execute.lua:110>
[Lua ] function 'fun' at </usr/share/tarantool/graphql/core/util.lua:5>
...

@Totktonada
Copy link
Member

It seems not so important for now, so I moved it from 0.0.1 milestone.

@Totktonada Totktonada removed this from the 0.0.1 milestone Jun 7, 2018
@opomuc opomuc added the prio2 label Jun 7, 2018
@opomuc
Copy link
Author

opomuc commented Jun 18, 2018

  • Incorrect type for service variables (limit, offset, etc)
Error catched: args.limit must be a number or nil, got string
Error occured at '/usr/share/tarantool/graphql/accessor_general.lua:971'
[C   ] function 'assert' at <[C]:-1>
[Lua ] function 'select' at </usr/share/tarantool/graphql/accessor_general.lua:971>
[Lua ] function 'defaultResolver' at </usr/share/tarantool/graphql/tarantool_graphql.lua:539>

@opomuc
Copy link
Author

opomuc commented Jun 18, 2018

  • couldn't create object from tuple??
Error catched: count[1] is not equal to objs count[0]
Error occured at '/usr/share/tarantool/graphql/accessor_general.lua:1085'
[C   ] function 'assert' at <[C]:-1>
[Lua ] function 'select' at </usr/share/tarantool/graphql/accessor_general.lua:1085>
[Lua ] function 'defaultResolver' at </usr/share/tarantool/graphql/tarantool_graphql.lua:539>
[Lua ] function 'fn' at </usr/share/tarantool/graphql/core/execute.lua:110>
[Lua ] function 'evaluateSelections' at </usr/share/tarantool/graphql/core/util.lua:5>

This also happens when:

  • empty variables for query variables={} for query obtain($var1: String, $limit: Int)

@opomuc opomuc added prio1 and removed prio2 labels Jun 20, 2018
Totktonada added a commit that referenced this issue Jun 20, 2018
Success case: {data = ...}
Error case: {errors = {message = ..., ...}}

compiled_query:execute(...) becomes exception-safe (performs pcall
internally), but graphql.new(...):compile() and
graphql.new(...).execute(...) still can throw an exception.

Enabled 5_2 test in common.test.lua, it fails before fix for #135 (
PR #178).

Increased timeout to 10 seconds in pcre.test.lua and
nested_args.test.lua (#137).

Prerequisite for #71.
Prerequisite for #134.
Fixes #137.
Totktonada added a commit that referenced this issue Jun 21, 2018
Success case: {data = ...}
Error case: {errors = {message = ..., ...}}

compiled_query:execute(...) becomes exception-safe (performs pcall
internally), but graphql.new(...):compile() and
graphql.new(...).execute(...) still can throw an exception.

Enabled 5_2 test in common.test.lua, it fails before fix for #135 (
PR #178).

Increased timeout to 10 seconds in pcre.test.lua and
nested_args.test.lua (#137).

Prerequisite for #71.
Prerequisite for #134.
Fixes #137.
@Totktonada
Copy link
Member

  • variables don't fit well with a query
  • query execution timeout exceeded
    • can be added
  • Incorrect type for service variables (limit, offset, etc)
  • couldn't create object from tuple??
    • it is the internal error; I’m against of setting code to an error that an user should not see at all; it is better to fix code
  • empty variables for query…
    • need to investigate if it is arisen when accessor functions are correct

Totktonada added a commit that referenced this issue Jun 22, 2018
Success case: {data = ...}
Error case: {errors = {message = ..., ...}}

compiled_query:execute(...) becomes exception-safe (performs pcall
internally), but graphql.new(...):compile() and
graphql.new(...).execute(...) still can throw an exception.

Enabled 5_2 test in common.test.lua, it fails before fix for #135 (
PR #178).

Increased timeout to 10 seconds in pcre.test.lua and
nested_args.test.lua (#137).

Prerequisite for #71.
Prerequisite for #134.
Fixes #137.
Totktonada added a commit that referenced this issue Jun 22, 2018
Success case: {data = ...}
Error case: {errors = {message = ..., ...}}

compiled_query:execute(...) becomes exception-safe (performs pcall
internally), but graphql.new(...):compile() and
graphql.new(...).execute(...) still can throw an exception.

Enabled 5_2 test in common.test.lua, it fails before fix for #135 (
PR #178).

Prerequisite for #71.
Prerequisite for #134.
Totktonada added a commit that referenced this issue Jul 2, 2018
Totktonada added a commit that referenced this issue Jul 2, 2018
Totktonada added a commit that referenced this issue Jul 2, 2018
Totktonada added a commit that referenced this issue Jul 2, 2018
Totktonada added a commit that referenced this issue Jul 2, 2018
Enhance validation and introduce error codes
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer enhancement New feature or request prio1
Projects
None yet
Development

No branches or pull requests

2 participants