Added exception handling to shell chunks.