(Incomplete) Catching exceptions and returning errors in plugin