I am trying to handle Graphql errors from Apollo server using Apollo server. My stack look like this.
Web Application => Apollo server1(S1) => Apollo server2(S2) => Database
Web Application can only connect to S1, S1 works as a proxy that have an authentication with some small logic. All business logic are on S2 which is connected to the Database.
The problem I am trying to handle is when S1 request to S2, but multiple errors occurred in S2. Response that S1 receive will look like this
{ data: null, errors: [{ message: "error1"... }, { message: "error2"... }] }
So S1 which is work as a proxy should also return error1 and error2 but I can only throw 1 error.
The question is how can I handle multiple Graphql errors in this situation ?