8 Replies Latest reply on Jan 24, 2007 7:23 AM by Newsgroup_User

    Identifying specific errors

    NoonEclipse
      Greetings,

      I would like to be able to handle some specific errors without having th script abort. For example, I have a form that allows users to upload a file and enter information about the file into a table. So when it comes to actually uploading the file, I can set an accept string to say Image/* to only allow images. If the user uploads a text file, the script aborts with a message. But I would prefer to output a message and return to the form, retaining the data entered.

      I can trap application errors, but I would really only like to look at this particular error. I see embedded in the CFCATCH structure the string "$InvalidUploadTypeException". Is there a list of such exception strings? Is there a place to find this without searching through the CFCATCH structure?

      Thanks for your help.

      Larry
        • 1. Re: Identifying specific errors
          Dan Bracuk Level 5
          javascript window.history.back(1) or whatever the proper syntax is often brings them with the form values in place,

          The other alternative is to store all the form variables as session variables and repopulate the form after you send the user back.
          • 2. Re: Identifying specific errors
            MikerRoo Level 1
            quote:

            Originally posted by: NoonEclipse
            I can trap application errors, but I would really only like to look at this particular error. I see embedded in the CFCATCH structure the string "$InvalidUploadTypeException". Is there a list of such exception strings? Is there a place to find this without searching through the CFCATCH structure?

            Thanks for your help.

            Larry


            There is no list of exceptions and such a list would change with every release or patch (still would be good if Adobe published the list).

            Yes, you must dive through the catch info, as sucky as that may be. There is no other ¿legal? way to get a list of exception types and there are at least 800 (roughly) possible exceptions as of CF 7.02.

            You might be alert for such things as:
            quote:

            CFFileNonMultipartException
            CouldNotDeleteFileException
            DirectoryIsFileException
            DirFileIsReadOnlyException
            DocumentFileExistsException
            EmptyFileUploadException
            FileCharConversionException
            FileDeleteFailedException
            FileNotFoundException
            FileOverwriteException
            FilePermissionException
            FormFileNotFoundException
            InvalidArchiveFileException
            InvalidCFFileActionException
            InvalidFileAttributeException
            InvalidFileFilterException
            InvalidUploadTypeException
            MultipleFileOperationException
            SingleFileOperationException



            But you didn't hear that from me! ;-)
            • 3. Re: Identifying specific errors
              NoonEclipse Level 1
              Thanks MikerRoo,

              I appreciate the info, although I am surprised that there isn't a better way. Most other languages make it simple and give you an error code or status code. Strange that ColdFusion does not.

              How did you generate this list? Other than creating every error and seeing what popped up?

              I appreciate the help.
              • 4. Re: Identifying specific errors
                MikerRoo Level 1
                BTW, there is a little help at:
                http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000225.htm

                As for that list, alas, I'm not allowed to say where I got it (damn lawyers) and there is nothing but names. You have to imagine what might trigger each.

                Adobe would be wise to keep a current list in live docs (except for MAYBE any "sensitive" items**). It would help them and it would help us.

                ** Of course, if such items came up in an error dump, they would eventually be revealed and probably first to the very worst eyes (hackers and competitors are the best at ferreting out such info).
                • 5. Re: Identifying specific errors
                  NoonEclipse Level 1
                  Amazing. Now why would hiding error information be a security problem? All of this is on the error page anyway, so they can be figured out. IF you want to wast the time doing it, and assuming that all of the strings relate to something meaningful.

                  I wonder if someone is just trying to protect their job? (If I don't tell people what the errors are they have to keep coming to me...) On the other hand, maybe they just don't want to make if easier for developers.

                  If I get fed up enough I will just move to another platform that does make such things easy.

                  Thanks for your sharing your knowledge.

                  Larry
                  • 6. Re: Identifying specific errors
                    Level 7
                    > Adobe would be wise to keep a current list in live docs (except for MAYBE any
                    > "sensitive" items**). It would help them and it would help us.

                    The CFMX8 beta is coming up. Get onto it, and make a feature request. Or
                    remind me in a couple of weeks and I'll do it. It's a good suggestion.

                    (Perhaps best to submit a standard feature request now...)

                    --
                    Adam
                    • 7. Re: Identifying specific errors
                      NoonEclipse Level 1
                      I have requested this feature. It was amazingly difficult to find where to do it, but I persevered and managed to do it.

                      Thanks for the suggestion Adam.
                      • 8. Re: Identifying specific errors
                        Level 7
                        > I have requested this feature. It was amazingly difficult to find where to do it, but I persevered and managed to do it.
                        > Thanks for the suggestion Adam.

                        I'll keep an eye out for it on the beta...

                        --
                        Adam