
When the exception is raised and each time it is continued extra information can be added to the exception trace.

If it has been continued by several handlers it will contain a lot of continue information in addition to the original exception information.
#Php try catch stream plus#
When an exception is continued it consists of the original exception plus some continue information.
#Php try catch stream code#
In this case the best thing the handler code can do is to continue the exception as an unknown exception (i.e.
#Php try catch stream how to#
Especially, it may be an exception that the handler does not know how to handle. If it is another kind of exception the handler will have to do something different. So for the "write-protected" exception the handler code should write a message to the user.

The user can choose a different filename, remove the write protection, delete the file, cancel the operation entirely or something else.

So the handling we want is simply to tell the user that the information was not written because the file was write-protected. In this case writeInfo is called after the user have entered the file name in a dialog and pressed a Save-button. When an exception is raised the program control is transferred to the nearest exception handler, which can hopefully handle the situation and thus bring the program back on track again. In outputStream_file :: create this situation is considered to be exceptional/unexpected and therefore it raises an exception. WriteInfo ( Filename ) :- S = outputStream_file :: create ( Filename ) ,īut if the file already exists and is write-protected it is impossible to create the stream.
