Boo

Ensure all exception handlers can be reached

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.8.2
  • Fix Version/s: 0.9
  • Component/s: Compiler
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

Boo should issue an error when an except block is unreachable because a previous block handles a super type of the exception (or the same exception).

Testcase:

"""
BCE0165-1.boo(17,11): BCE0165: 'System.ArgumentException' is already handled by except block for 'System.Exception' at (15,11).
BCE0165-1.boo(19,11): BCE0165: 'System.ArgumentNullException' is already handled by except block for 'System.ArgumentException' at (17,11).
BCE0165-1.boo(21,11): BCE0165: 'System.NotImplementedException' is already handled by except block for 'System.Exception' at (15,11).
BCE0165-1.boo(23,11): BCE0165: 'System.ArgumentException' is already handled by except block for 'System.ArgumentException' at (17,11).
"""
import System

x = 1

try:
	print "foo"
except as InvalidOperationException:
	pass
except as Exception:
	pass
except as ArgumentException:
	pass
except as ArgumentNullException:
	pass
except as NotImplementedException:
	pass
except as ArgumentException: #dupe
	pass

try:
	print "bar"
except as ArgumentException if x == 1:
	pass
except as ArgumentException: #not a dupe (filter)
	pass

Activity

Hide
Cedric Vivier added a comment -

Fixed in rev 3110

Show
Cedric Vivier added a comment - Fixed in rev 3110

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: