raise exception insteadet os_exit(2) on realm error