]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | <?php |
2 | /* | |
3 | * Licensed to the Apache Software Foundation (ASF) under one | |
4 | * or more contributor license agreements. See the NOTICE file | |
5 | * distributed with this work for additional information | |
6 | * regarding copyright ownership. The ASF licenses this file | |
7 | * to you under the Apache License, Version 2.0 (the | |
8 | * "License"); you may not use this file except in compliance | |
9 | * with the License. You may obtain a copy of the License at | |
10 | * | |
11 | * http://www.apache.org/licenses/LICENSE-2.0 | |
12 | * | |
13 | * Unless required by applicable law or agreed to in writing, | |
14 | * software distributed under the License is distributed on an | |
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
16 | * KIND, either express or implied. See the License for the | |
17 | * specific language governing permissions and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @package thrift | |
21 | */ | |
22 | ||
23 | namespace Thrift\Exception; | |
24 | ||
25 | use Thrift\Type\TType; | |
26 | ||
27 | class TApplicationException extends TException | |
28 | { | |
29 | public static $_TSPEC = | |
30 | array(1 => array('var' => 'message', | |
31 | 'type' => TType::STRING), | |
32 | 2 => array('var' => 'code', | |
33 | 'type' => TType::I32)); | |
34 | ||
35 | const UNKNOWN = 0; | |
36 | const UNKNOWN_METHOD = 1; | |
37 | const INVALID_MESSAGE_TYPE = 2; | |
38 | const WRONG_METHOD_NAME = 3; | |
39 | const BAD_SEQUENCE_ID = 4; | |
40 | const MISSING_RESULT = 5; | |
41 | const INTERNAL_ERROR = 6; | |
42 | const PROTOCOL_ERROR = 7; | |
43 | const INVALID_TRANSFORM = 8; | |
44 | const INVALID_PROTOCOL = 9; | |
45 | const UNSUPPORTED_CLIENT_TYPE = 10; | |
46 | ||
47 | public function __construct($message = null, $code = 0) | |
48 | { | |
49 | parent::__construct($message, $code); | |
50 | } | |
51 | ||
52 | public function read($output) | |
53 | { | |
54 | return $this->_read('TApplicationException', self::$_TSPEC, $output); | |
55 | } | |
56 | ||
57 | public function write($output) | |
58 | { | |
59 | $xfer = 0; | |
60 | $xfer += $output->writeStructBegin('TApplicationException'); | |
61 | if ($message = $this->getMessage()) { | |
62 | $xfer += $output->writeFieldBegin('message', TType::STRING, 1); | |
63 | $xfer += $output->writeString($message); | |
64 | $xfer += $output->writeFieldEnd(); | |
65 | } | |
66 | if ($code = $this->getCode()) { | |
67 | $xfer += $output->writeFieldBegin('type', TType::I32, 2); | |
68 | $xfer += $output->writeI32($code); | |
69 | $xfer += $output->writeFieldEnd(); | |
70 | } | |
71 | $xfer += $output->writeFieldStop(); | |
72 | $xfer += $output->writeStructEnd(); | |
73 | ||
74 | return $xfer; | |
75 | } | |
76 | } |