compute: clean up try-except and if-else blocks