The program below uses an object with write and close methods, and then prints the class and message of the rescued exception. You need to determine the exact stdout output for the current code.
stdout with exact formatting.ensure when an exception occurs both in the main block and during resource cleanup.Run the file with:
ruby main.rb
The program deterministically prints exactly one line to stdout, depending on which exception leaves the publish method after ensure has finished.
main.rbruby main.rbClick a line and write what it prints. Explanation is optional.