1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Error checking after sql queries in installer/uninstaller?

Discussion in 'XenForo Development Discussions' started by rugk, Aug 12, 2015.

  1. rugk

    rugk Active Member

    As there is no error checking after mysql queries in any code of a development tutorial here in XenForo I just want to ask: Is it not necessary to check sql errors by yourself (and throw an exception in case there is one) because XenForo already does this all?

    Or would it be not a bad idea to add an error check after an sql query (e.g. in the installer class) and check manually whether the query was successful?
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    The decision is up to you. If you check and catch them, you can recover from it. If you don't, the query will fail and you will have to deal with it later.
  3. rugk

    rugk Active Member

    Well... okay, so there is a need for error checking there.
    And as for the installer class?
    As there is not really something you can recover if it fails you always have to stop the installation (by throwing an exception). XenForo seems to already cover many errors which can occur in the sql query - that's the reason for my question.
    So is it needed/useful there to check (again) for errors or this this redundant?

Share This Page