Algorithms and OOD (CSC 207 2013F) : EBoards

CSC207.01 2013F, Class 10: Exceptional Programming


Overview

Admin

Questions on HW3

Dealing with errors


A procedure that can fail

public static type proc(inputs) throws Exception

Fail

throw new Exception("reason");

Dealing with errors - throw your own

public static type caller(inputs) throws Exception { proc(...); }

Dealing with errors - Provide the alternate flow of control

public static type caller(inputs) { try { proc(...); ...; } catch (Exception e) { // RECOVER }

Lab

Copyright (c) 2013 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.