<?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 Obj-C API v2 Error Handling in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191937#M8457</link>
    <description>&lt;P&gt;Hi folks, I find myself having more questions about error handling in the obj-c API v2. I keep going over the README and I am still unable to figure out where I should look for documentation on figuring out what's in a routeError and when I should look to it instead of (or in addition to) the error param in a response block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, create folder:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DropboxClient *client = [DropboxClientsManager authorizedClient];
if (client != nil) {
    [[client.filesRoutes createFolder:self.rootPath] 
    response:^(DBFILESFolderMetadata * _Nullable result, DBFILESCreateFolderError * _Nullable routeError, DBError * _Nullable error) {
        if (result != nil) {
            // Onward to the next step!
            [self doNextThing]
        } else {
            // Bummers? which bummers?
        }
    }];
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I go to the documentation and lookup that route error type, DBFilesCreateFolderError, and that says it's "The CreateFolderError union." All I see there is "isPath". I don't see any&amp;nbsp;methods mentioned in the error handling section of the README&amp;nbsp;like isWriteError.&lt;BR /&gt;&lt;BR /&gt;So, what's the process of figuring out what I should be looking for here, where do I look so that I don't have to ask here for every route? Sorry if that sounds melodramatic, I just want to do it right and understand where to look for the answers myself &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:28:56 GMT</pubDate>
    <dc:creator>billymeltdown</dc:creator>
    <dc:date>2019-05-29T09:28:56Z</dc:date>
    <item>
      <title>Obj-C API v2 Error Handling</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191937#M8457</link>
      <description>&lt;P&gt;Hi folks, I find myself having more questions about error handling in the obj-c API v2. I keep going over the README and I am still unable to figure out where I should look for documentation on figuring out what's in a routeError and when I should look to it instead of (or in addition to) the error param in a response block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, create folder:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DropboxClient *client = [DropboxClientsManager authorizedClient];
if (client != nil) {
    [[client.filesRoutes createFolder:self.rootPath] 
    response:^(DBFILESFolderMetadata * _Nullable result, DBFILESCreateFolderError * _Nullable routeError, DBError * _Nullable error) {
        if (result != nil) {
            // Onward to the next step!
            [self doNextThing]
        } else {
            // Bummers? which bummers?
        }
    }];
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I go to the documentation and lookup that route error type, DBFilesCreateFolderError, and that says it's "The CreateFolderError union." All I see there is "isPath". I don't see any&amp;nbsp;methods mentioned in the error handling section of the README&amp;nbsp;like isWriteError.&lt;BR /&gt;&lt;BR /&gt;So, what's the process of figuring out what I should be looking for here, where do I look so that I don't have to ask here for every route? Sorry if that sounds melodramatic, I just want to do it right and understand where to look for the answers myself &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:28:56 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191937#M8457</guid>
      <dc:creator>billymeltdown</dc:creator>
      <dc:date>2019-05-29T09:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Obj-C API v2 Error Handling</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191940#M8458</link>
      <description>&lt;P&gt;I should add, I've also gone over to the API docs themselves (not the obj-c ones) and then I look at the corresponding method there, &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-create_folder" target="_self"&gt;/create_folder&lt;/A&gt;, and still I don't see information I can turn into code the way I'm understanding this. For errors it shows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CreateFolderError (union)&lt;BR /&gt;The value will be one of the following datatypes:&lt;BR /&gt;path WriteError&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I go back to my response block, and I check to see if routeError has an isWriteError property: it does not. So then I click on WriteError in the http docs and it expands:&lt;BR /&gt;&lt;BR /&gt;The value will be one of the following datatypes. New values may be introduced as our API evolves.&lt;BR /&gt;malformed_path String? This field is optional.&lt;BR /&gt;conflict WriteConflictError Couldn't write to the target path because there was something in the way.&lt;BR /&gt;no_write_permission Void The user doesn't have permissions to write to the target location.&lt;BR /&gt;insufficient_space Void The user doesn't have enough available space (bytes) to write more data.&lt;BR /&gt;disallowed_name Void Dropbox will not save the file or folder because of its name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Okay, cool, so I go back to the readme and it says&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;To properly handle union types, you should call each of the&amp;nbsp;&lt;/SPAN&gt;is&amp;lt;TAG_STATE&amp;gt;&lt;SPAN&gt;&amp;nbsp;methods associated with the union.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Okay, so, what methods are available, how do I determine those with the info above? All I see is "isPath" ....&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 14:23:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191940#M8458</guid>
      <dc:creator>billymeltdown</dc:creator>
      <dc:date>2016-10-25T14:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Obj-C API v2 Error Handling</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191973#M8464</link>
      <description>&lt;P&gt;For each API call, you'll want to handle both the route error (for errors specific to that call) as well as the general error (for errors that&amp;nbsp;can happen on any call).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the route specific error for createFolder, which is &lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESCreateFolderError.html" target="_self"&gt;DBFILESCreateFolderError&lt;/A&gt;, there is only the isPath case, since that error doesn't have any other scenarios. (The &lt;A href="https://github.com/dropbox/dropbox-sdk-obj-c#route-specific-errors" target="_self"&gt;example in the README&lt;/A&gt; is for the delete call, which has a different set of possible route-specific errors, under &lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESDeleteError.html" target="_self"&gt;DBFILESDeleteError&lt;/A&gt;.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To see what is possible for any particular error, I&amp;nbsp;recommend checking the Objective-C SDK documentation for that error type, e.g., &lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESCreateFolderError.html" target="_self"&gt;DBFILESCreateFolderError&lt;/A&gt;, which lists just isPath. (You can look at the HTTP documenation, as you linked to, but the names won't always be exactly the same, as they get translated slightly&amp;nbsp;for the SDK.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, if DBFILESCreateFolderError isPath is true, you can then access the &lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESWriteError.html" target="_self"&gt;DBFILESWriteError&lt;/A&gt; in it via the path field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a more elaborate sample for createFolder showing that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [[client.filesRoutes createFolder:@"/test/path"] response:^(DBFILESFolderMetadata *result, DBFILESCreateFolderError *routeError, DBError *error) {
            if (result) {
                NSLog(@"%@\n", result);
            } else if (routeError) {
                NSLog(@"%@\n", routeError);
                if ([routeError isPath]) {
                    if ([routeError.path isConflict]) {
                        if ([routeError.path.conflict isFolder]) {
                            NSLog(@"Could not create folder because a folder already exists at path.");
                        } else {
                            // some other path conflict error:
                            NSLog(@"%@\n", routeError.path.conflict);
                        }
                    } else if ([routeError.path isMalformedPath]) {
                        NSLog(@"Could not create folder because the path is malformed.");
                    } else { // and so on for other errors as desired
                        // some other path error:
                        NSLog(@"%@\n", routeError.path);
                    }
                }
            } else if (error) {
                NSLog(@"%@\n", error);
            }
        }];&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:14:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191973#M8464</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-10-25T18:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Obj-C API v2 Error Handling</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191975#M8465</link>
      <description>&lt;P&gt;Ohhhhh, okay I get it! Thanks, Greg!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 18:17:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Obj-C-API-v2-Error-Handling/m-p/191975#M8465</guid>
      <dc:creator>billymeltdown</dc:creator>
      <dc:date>2016-10-25T18:17:07Z</dc:date>
    </item>
  </channel>
</rss>

