File tree Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -992,7 +992,7 @@ let get_project_field_values ~bot_info ~organization ~project ~field ~options =
992
992
let open GitHub_GraphQL.GetProjectFieldValues in
993
993
makeVariables ~organization ~project ~field ~options ()
994
994
|> serializeVariables |> variablesToJson
995
- |> send_graphql_query ~bot_info ~query
995
+ |> send_graphql_query ~bot_info ~query ~ignore_errors: true
996
996
~parse: (Fn. compose parse unsafe_fromJson)
997
997
>> = function
998
998
| Ok result -> (
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ open Utils
4
4
5
5
type api = GitHub | GitLab of string
6
6
7
- let send_graphql_query ~bot_info ?(extra_headers = [] ) ~ api ~ query ~ parse
8
- variables =
7
+ let send_graphql_query ~bot_info ?(extra_headers = [] ) ?( ignore_errors = false )
8
+ ~ api ~ query ~ parse variables =
9
9
let uri =
10
10
( match api with
11
11
| GitLab gitlab_domain ->
@@ -46,17 +46,20 @@ let send_graphql_query ~bot_info ?(extra_headers = []) ~api ~query ~parse
46
46
let json = Yojson.Basic. from_string body in
47
47
let open Yojson.Basic.Util in
48
48
let data = json |> member " data" |> parse in
49
- match member " errors" json with
50
- | `Null ->
51
- Ok data
52
- | errors ->
53
- let errors =
54
- to_list errors
55
- |> List. map ~f: (fun error -> error |> member " message" |> to_string)
56
- in
57
- Error
58
- ( " Server responded to GraphQL request with errors: "
59
- ^ String. concat ~sep: " , " errors )
49
+ if ignore_errors then Ok data
50
+ else
51
+ match member " errors" json with
52
+ | `Null ->
53
+ Ok data
54
+ | errors ->
55
+ let errors =
56
+ to_list errors
57
+ |> List. map ~f: (fun error ->
58
+ error |> member " message" |> to_string )
59
+ in
60
+ Error
61
+ ( " Server responded to GraphQL request with errors: "
62
+ ^ String. concat ~sep: " , " errors )
60
63
with
61
64
| Failure err ->
62
65
Error (f " Exception: %s" err)
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ type api = GitHub | GitLab of string
3
3
val send_graphql_query :
4
4
bot_info :Bot_info .t
5
5
-> ?extra_headers : (string * string ) list
6
+ -> ?ignore_errors : bool
6
7
-> api :api
7
8
-> query :string
8
9
-> parse :(Yojson .Basic .t -> 'a )
You can’t perform that action at this time.
0 commit comments