Rev 30 | Blame | Compare with Previous | Last modification | View Log | RSS feed
## 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.#module Thriftclass Exception < StandardErrordef initialize(message)super@message = messageendattr_reader :messageendclass ApplicationException < ExceptionUNKNOWN = 0UNKNOWN_METHOD = 1INVALID_MESSAGE_TYPE = 2WRONG_METHOD_NAME = 3BAD_SEQUENCE_ID = 4MISSING_RESULT = 5attr_reader :typedef initialize(type=UNKNOWN, message=nil)super(message)@type = typeenddef read(iprot)iprot.read_struct_beginwhile truefname, ftype, fid = iprot.read_field_beginif ftype == Types::STOPbreakendif fid == 1 and ftype == Types::STRING@message = iprot.read_stringelsif fid == 2 and ftype == Types::I32@type = iprot.read_i32elseiprot.skip(ftype)endiprot.read_field_endendiprot.read_struct_endenddef write(oprot)oprot.write_struct_begin('Thrift::ApplicationException')unless @message.nil?oprot.write_field_begin('message', Types::STRING, 1)oprot.write_string(@message)oprot.write_field_endendunless @type.nil?oprot.write_field_begin('type', Types::I32, 2)oprot.write_i32(@type)oprot.write_field_endendoprot.write_field_stopoprot.write_struct_endendendend