Forum Discussion

RJKinsman's avatar
RJKinsman
Helpful | Level 6
7 years ago
Solved

How to capture the error message

I want to capture the error message so I can do different actions depending on the text.  I can't figure out how to code this.  Here's my code...

        if DropboxClientsManager.authorizedClient != nil {
            print("We have an authorized client.  Now let's see if we can get the file attributes")
            
            // Check to see if Nvelopes.csv exists in Dropbox.
//            client!.files.getMetadata(path: "/Nvelopes.csv")
             client!.files.getMetadata(path: "/Nvelopes1.csv")
                .response {_ , error in
                    if let error = error {
                        print("We did not get the attributes :(")
                        print(error.description)
                        self.window?.rootViewController = mainStoryboard.instantiateViewController(withIdentifier: "sbLinkToDropbox") as UIViewController
                                            }
             }
            
        }

... and here's the result of print(error.description):

[request-id 7185a7cb73542868da1649971559a895] API route error - {
    ".tag" = path;
    path =     {
        ".tag" = "not_found";
    };
}

How do I capture the part after ".tag" =??

Thanks for your patience!

2 Replies

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!