Commit c39b462d9eef8bf8e283e4e8fe5a422827cff644

Authored by Christian Herdtweck
1 parent f1e5ebe7

remove try-except around blocks from which exceptions should never be thrown

Showing 1 changed file with 7 additions and 15 deletions
oletools/olevba.py
@@ -2165,11 +2165,8 @@ class VBA_Parser(object): @@ -2165,11 +2165,8 @@ class VBA_Parser(object):
2165 log.debug('%s does not contain a valid OLE file (%s)' 2165 log.debug('%s does not contain a valid OLE file (%s)'
2166 % (fname, exc)) 2166 % (fname, exc))
2167 else: 2167 else:
2168 - try:  
2169 - log.debug('type(part_data) = %s' % type(part_data))  
2170 - log.debug('part_data[0:20] = %r' % part_data[0:20])  
2171 - except Exception:  
2172 - pass 2168 + log.debug('type(part_data) = %s' % type(part_data))
  2169 + log.debug('part_data[0:20] = %r' % part_data[0:20])
2173 # set type only if parsing succeeds 2170 # set type only if parsing succeeds
2174 self.type = TYPE_MHTML 2171 self.type = TYPE_MHTML
2175 except Exception: 2172 except Exception:
@@ -2185,16 +2182,11 @@ class VBA_Parser(object): @@ -2185,16 +2182,11 @@ class VBA_Parser(object):
2185 :return: nothing 2182 :return: nothing
2186 """ 2183 """
2187 log.info('Opening text file %s' % self.filename) 2184 log.info('Opening text file %s' % self.filename)
2188 - try:  
2189 - # directly store the source code:  
2190 - self.vba_code_all_modules = data  
2191 - self.contains_macros = True  
2192 - # set type only if parsing succeeds  
2193 - self.type = TYPE_TEXT  
2194 - except Exception:  
2195 - log.exception('Failed text parsing for file %r - %s'  
2196 - % (self.filename, MSG_OLEVBA_ISSUES))  
2197 - pass 2185 + # directly store the source code:
  2186 + self.vba_code_all_modules = data
  2187 + self.contains_macros = True
  2188 + # set type only if parsing succeeds
  2189 + self.type = TYPE_TEXT
2198 2190
2199 2191
2200 def find_vba_projects(self): 2192 def find_vba_projects(self):