]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/rb/lib/thrift/exceptions.rb
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
21 class Exception
< StandardError
22 def initialize(message
)
30 class ApplicationException
< Exception
34 INVALID_MESSAGE_TYPE
= 2
42 UNSUPPORTED_CLIENT_TYPE
= 10
46 def initialize(type
=UNKNOWN
, message
=nil)
52 iprot
.read_struct_begin
54 fname
, ftype
, fid
= iprot
.read_field_begin
55 if ftype
== Types
::STOP
58 if fid
== 1 and ftype
== Types
::STRING
59 @message = iprot
.read_string
60 elsif fid
== 2 and ftype
== Types
::I32
61 @type = iprot
.read_i32
71 oprot
.write_struct_begin('Thrift::ApplicationException')
73 oprot
.write_field_begin('message', Types
::STRING, 1)
74 oprot
.write_string(@message)
78 oprot
.write_field_begin('type', Types
::I32, 2)
79 oprot
.write_i32(@type)
82 oprot
.write_field_stop
83 oprot
.write_struct_end