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

As Designed XenForo_DataWriter::ERROR_SILENT... doesn't work...

Discussion in 'Resolved Bug Reports' started by Jaxel, May 13, 2011.

  1. Jaxel

    Jaxel Well-Known Member

    My code:
    PHP:
    public function buildModuleCache($module$settings)
    {
        
    $dw XenForo_DataWriter::create('EWRporta_DataWriter_Cache'XenForo_DataWriter::ERROR_SILENT);
        if (
    $cache $this->getCacheByName($module['module_name']))
        {
            
    $dw->setExistingData($cache);
        }
        else
        {
            
    $dw->set('module_name'$module['module_name']);
        }
        
    $dw->set('module_settings'$settings);
        
    $dw->save(); // this is line 38

        
    return true;
    }
    Yet I just got this error:
     
  2. Mike

    Mike XenForo Developer Staff Member

    That's sort of debatable. ERROR_SILENT silences errors triggered; we assume that you are checking for things like unique key limits yourself. If we suppress errors like this, there are various other types that could come up - I'm not sure whether we suppress them, though I could be persuaded either way I think.
     
  3. Jaxel

    Jaxel Well-Known Member

    Well is there any way to catch this error and then ignore it?
     
  4. Mike

    Mike XenForo Developer Staff Member

    You can wrap your save method call in a try-catch.
     

Share This Page