try { open(); read(); ... } catch (FILE_NOT_FOUND) { // handle error } catch (INSUFFICIENT_PERMISSIONS) { // handle error } catch (DISK_ERROR) { // handle error }