        } catch (GateMethodInternalException e) {
$DECLARED_EXCEPTIONS
            // if runtime exception occured in remote method, just re-throw it
            if (e.getCause() instanceof RuntimeException)
                throw new Exception((RuntimeException) e.getCause());

            throw new GateMethodInvocationException("Error or unknown checked exception was thrown by a method.", e);
        } catch (GateFromServiceException e) {
            // this indicates a normal exception from remote service.
            throw new Exception(e);
        } catch (GateException e) {            
            // this is a RuntimeException, so we can throw it safely
            // indicates any gate setup problem (connection refused/authorization failed/missing class/.. etc.)
            throw new Exception(e);
        }  catch (RuntimeException e) {
            // this indicates a bug in gate
            throw new Exception(e);
        } catch (Exception e) {
            // this indicates a bug in gate
            throw new Exception(e);
        }
