owainlewis / clojure-mail

A Clojure library for parsing, downloading and reading email from IMAP servers.
203 stars 54 forks source link

Handling errors when opening store #28

Open shmish111 opened 9 years ago

shmish111 commented 9 years ago

Hi,

I've been having a problem when dealing with a store failing to open. I want to a) get the error message and b) know it's an error. At the moment a failure to open a store returns a string. I could test the type that is returned but I feel it's quite clunky and a bit old skool. To me the options are:

  1. Don't catch the error
  2. Use some sort of Either type
  3. Log the error and return nil

Currently I think I would prefer to not catch the error; opening the store is something that I would expect to be done quite early on, for example I open a store in my main method. I would be happy to catch the Exception along with any other possibles as I start my program as it is a fatal error. What do you think? Let me know and I can create a PR.

owainlewis commented 9 years ago

Hi,

In this case I'd agree that not catching the error is the most sensible thing as nothing else can go ahead from this point on.