/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

namespace java thrift.test.voidmethexceptions

exception TExampleException {
  1: required string message;
}

service TAppService01 {
  string returnString(1: string msg, 2: bool throwException) throws (1:TExampleException error);
  void returnVoidThrows(1: string msg, 2: bool throwException) throws (1:TExampleException error);
  void returnVoidNoThrowsRuntimeException(1: string msg, 2: bool throwException);
  void returnVoidNoThrowsTApplicationException(1: string msg, 2: bool throwException);
  oneway void onewayVoidNoThrows(1: string msg, 2: bool throwException);
}
