Change tryCatch to handle Error objects when cause is StackOverflowError