Style note:

```elixir
try do
  :erlang.binary_to_integer(primary)
rescue
  ArgumentError -> :error
end
```

But I would try to get rid of the try in the first place, you can simply check if primary is an empty string or not.