Added nested error handling for cases resulting in unhelpful stack traces