<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Java: How do handle 404 and 50x errors? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-How-do-handle-404-and-50x-errors/m-p/208435#M10294</link>
    <description>&lt;P&gt;I'm migrating from V1 to V2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the past I an error code was&amp;nbsp;an integer that I could look at. Now it's part of a string I presume (i.e. getMessage()).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are no examples of&amp;nbsp;how the errors would look like if these are 40x errors or 50x errors. How do I handle these? What should I expect, say, if the storage has run out on the server? Previously we used to get a 507 error (as in integer), what should I now expect?&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:25:29 GMT</pubDate>
    <dc:creator>Fahad G.</dc:creator>
    <dc:date>2019-05-29T09:25:29Z</dc:date>
    <item>
      <title>Java: How do handle 404 and 50x errors?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-How-do-handle-404-and-50x-errors/m-p/208435#M10294</link>
      <description>&lt;P&gt;I'm migrating from V1 to V2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the past I an error code was&amp;nbsp;an integer that I could look at. Now it's part of a string I presume (i.e. getMessage()).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are no examples of&amp;nbsp;how the errors would look like if these are 40x errors or 50x errors. How do I handle these? What should I expect, say, if the storage has run out on the server? Previously we used to get a 507 error (as in integer), what should I now expect?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:25:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-How-do-handle-404-and-50x-errors/m-p/208435#M10294</guid>
      <dc:creator>Fahad G.</dc:creator>
      <dc:date>2019-05-29T09:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Java: How do handle 404 and 50x errors?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-How-do-handle-404-and-50x-errors/m-p/208511#M10299</link>
      <description>&lt;P&gt;In the file &lt;STRONG&gt;DbxRequestUtil.java&lt;/STRONG&gt;, method&amp;nbsp;&lt;STRONG&gt;parseErrorBody,&amp;nbsp;&lt;/STRONG&gt;I can see that&amp;nbsp;&lt;SPAN&gt;statusCode is not&amp;nbsp;used / appended to the body of the error message. This does not help as we need to be able to handle these errors reliably. What makes it more difficult is that unless you specify the locale to be 'en', all messages are localized, effectively&amp;nbsp;rendering our parsing routines useless.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What&amp;nbsp;I need to do is reliably parse and handle error codes.&amp;nbsp;There's certain part of our app's logic that needs to be triggered, and not just an error displayed. How can I reliably do this with v2?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 18:33:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-How-do-handle-404-and-50x-errors/m-p/208511#M10299</guid>
      <dc:creator>Fahad G.</dc:creator>
      <dc:date>2017-02-25T18:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Java: How do handle 404 and 50x errors?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-How-do-handle-404-and-50x-errors/m-p/208540#M10300</link>
      <description>&lt;P&gt;Hi Fahad, if you're using the&amp;nbsp;Dropbox API v2 Java SDK, the SDK will translate these 4xx or 5xx error responses into exceptions for you, so you don't have to parse them yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance, in the &lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/upload-file/src/main/java/com/dropbox/core/examples/upload_file/Main.java#L49" target="_self"&gt;upload_file example here&lt;/A&gt;, there's some basic exception handling for some of the different kinds of exceptions that may get thrown.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/DbxUploadStyleBuilder.html#uploadAndFinish-java.io.InputStream-" target="_self"&gt;uploadAndFinish&lt;/A&gt;&amp;nbsp;method&amp;nbsp;throws a few different types of exceptions. For example, &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/DbxApiException.html" target="_self"&gt;DbxApiException&lt;/A&gt;&amp;nbsp;covers some 4xx issues, and &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/DbxException.html" target="_self"&gt;DbxException&lt;/A&gt;&amp;nbsp;covers some other more general errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That way, you&amp;nbsp;don't need to know the specific error codes. You can check the type of the error for more granular error handling. For example, &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/files/UploadErrorException.html" target="_self"&gt;UploadErrorException&lt;/A&gt;&amp;nbsp;is a subtype of&amp;nbsp;DbxApiException, and covers some errors specific to uploading. (This would be a 409 from that endpoint.) Likewise, &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/ServerException.html" target="_self"&gt;ServerException&lt;/A&gt;&amp;nbsp;is a subtype of&amp;nbsp;DbxException, and would indicate a server error. (That would be a 500.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can continue checking nested errors for more and&amp;nbsp;more specific information, such as via &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/files/WriteError.html#isInsufficientSpace--" target="_self"&gt;WriteError.isInsufficientSpace&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 22:45:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-How-do-handle-404-and-50x-errors/m-p/208540#M10300</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-02-25T22:45:39Z</dc:date>
    </item>
  </channel>
</rss>

