GraphQL – How to respond with different status code?

I’m having a trouble with Graphql and Apollo Client.

I always created different responses like 401 code when using REST but here I don’t know how to do a similar behavior.

When I get the response, I want it to go to the catch function.
An example of my front-end code:

client.query({
  query: gql`
    query TodoApp {
      todos {
        id
        text
        completed
      }
    }
  `,
})
  .then(data => console.log(data))
  .catch(error => console.error(error));

Can anybody help me?

211 thoughts on “GraphQL – How to respond with different status code?”

  1. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored material stylish. nonetheless, you command get got an edginess over
    that you wish be delivering the following.
    unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you shield this hike. http://cleckleyfloors.com/

    Reply
  2. What i don’t understood is if truth be told how you are no longer really much more
    neatly-preferred than you may be now. You are very intelligent.
    You understand thus considerably when it comes to
    this matter, produced me personally imagine it from numerous varied angles.
    Its like men and women aren’t involved except it’s one thing to accomplish with Girl
    gaga! Your individual stuffs nice. All the time handle it up! http://antiibioticsland.com/Doxycycline.htm

    Reply
  3. Pingback: deltasone a45
  4. hello my lovely stopforumspam member

    What are the Types of Loans in Ohio depending on the purpose
    Specific purpose payday loans in Ohio. Funds received in debt may be spent only for a specific purpose specified in the loan agreement.
    Non-purpose loan. The debtor may spend the money received at his discretion.
    Most popular specific purpose payday loans in Ohio are:

    House loan. The most common, of course, is a mortgage when the purchased property acts as collateral for a loan. Sometimes a youth loan is issued, with lighter conditions for debtors. Still quite common is a housing loan that does not imply purchased housing in the form of collateral.
    Car loan – payday loans in Ohio to a car or similar vehicle. The key is often the purchased goods, making the terms of the loan better. Also, loan conditions are improved: car insurance, life and health insurance of the borrower, and receiving a salary to the account of the creditor bank.
    Land loan. To purchase a plot for construction or agricultural activities.
    Consumer. For purchases in modern supermarkets, equipment stores, you can take a personal loan right at the point of sale. Often, specialists located there can contact the bank and get a regular or fast payday loans. Borrowed funds automatically pay for the goods, and the consultant explains when and how to re-pay the debt.
    Educational loan. It is issued to students, as well as to applicants who have passed the competition, to pay for tuition at universities, colleges, etc.
    Broker loan. For the circulation of securities, payday loans in Ohio are issued to an exchange broker, se-curities are purchased securities.
    Others. Objectives not related to those listed, but agreed and approved by the creditor.

    Reply

Leave a Comment