title: Store GraphQL errors as String
body: <p>I have a login form. When the submit button is hit, I check via the GraphQL backend if email and password are correct. If yes, a token is returned and stored in local storage.  At times, there are <strong>errors</strong> like: </p>
  
  <p><strong>'Incorrect Password' or 'User Doesn't Exist'.</strong></p>
  
  <p>Is there any way to <strong>store these errors as strings</strong> so I can display them later using conditional rendering? </p>
  
  <p>This is how my mutation looks like:</p>
  
  <pre><code>function submitForm(LoginMutation: any) {
      const { email, password } = state;
      if(email &amp;&amp; password){
        LoginMutation({
          variables: {
              email: email,
              password: password,
          },
      }).then(({ data }: any) =&gt; {
        localStorage.setItem('token', data.loginEmail.accessToken);
      })
      .catch(console.log)
      }
    }
  </code></pre>
  
  <p>and I am using it like this in my return</p>
  
  <pre><code> return (
        &lt;Mutation mutation={LoginMutation}&gt;
          {(LoginMutation: any) =&gt; (
          ....)}&gt;
         &lt;/Mutation&gt;
  )
  </code></pre>
  
  <p>For now, I am just displaying a single error on the basis of whether the token exists or not but I want to make my error specific to the GraphQL errors.</p>
  
  <pre><code>function ShowError(){
    if (!localStorage.getItem('token'))
    {
      console.log('Login Not Successful');
      return &lt;Typography color='primary'&gt;Login Not Successful&lt;/Typography&gt;
  
    }
  }
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>Example Error:</p>
  
  <pre><code>[Log] Error: GraphQL error: Key (email)=(c@c.com) already exists.
  </code></pre>
  
  <p>I tried this but it never logs anything:</p>
  
  <pre><code>.then(({data, errors}:any) =&gt; {
          if (errors &amp;&amp; errors.length) {
            console.log('Errors', errors);
            setErrorMessage(errors[0].message);
            console.log('Whats the error', errors[0].message)
          } else {
            console.log('ID: ', data.createUser.id);
          }
        })
      ```
  The backend isn't made by me
  
  
  </code></pre>