facebookarchive / swift

An annotation-based Java library for creating Thrift serializable types and services.
Apache License 2.0
900 stars 297 forks source link

Declare thrown exceptions for ThriftEventHandler and ContextChain methods #316

Closed TomasVaskevicius closed 8 years ago

TomasVaskevicius commented 8 years ago

ThriftServiceProcessor wraps calls to ThriftMethodProcessor in try {} catch (Exception e) {} so I think that we should declare checked exceptions in the ThriftEventHandler. Declared checked exceptions are useful, because once we have them, we could, for example, throw an exception in preRead() method if our ThriftEventHandler fails to authenticate a particular request.

TomasVaskevicius commented 8 years ago

@haijunz

haijunz commented 8 years ago

I am assuming this builds because these handler methods are only called from swift/nifty library and all such calls are wrapped with try...catch? If so LGTM

TomasVaskevicius commented 8 years ago

Yes, these methods are only called in try...catch(Exception e) blocks or in methods whose signature declares 'throws Exception'.