Good idea. I would suggest the following Ruby code:

```ruby
abort("ERROR: ...") unless dir
```