blob: a80b9d18215f3acb21200f9585f2f3ced45b2365 [file] [log] [blame]
jat@google.com5e86cbd2009-08-22 23:59:24 +00001#ifndef __FATALERRORMESSAGE_H
2#define __FATALERRORMESSAGE_H
3/*
4 * Copyright 2009 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 * use this file except in compliance with the License. You may obtain a copy of
8 * the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations under
16 * the License.
17 */
18
19#include <string>
20#include "Message.h"
21#include "BrowserChannel.h"
22#include "Value.h"
23
24class HostChannel;
25
26/**
27 * Class representing an FatalError message received from the server.
28 *
29 * This message indicates that a fatal error occurred during the processing
30 * of the previous message from the client and the connection should be
31 * aborted.
32 */
33class FatalErrorMessage : public Message {
34public:
35 static const char TYPE = MESSAGE_TYPE_FATAL_ERROR;
36private:
37 std::string error;
38
39protected:
40 /**
41 * @param error error message
42 */
43 FatalErrorMessage(const std::string& error) : error(error) {}
44
45public:
46 ~FatalErrorMessage();
47 virtual char getType() const;
48
49 const std::string& getError() const { return error; }
50
51 static FatalErrorMessage* receive(HostChannel& channel);
52 static bool send(HostChannel& channel, const std::string& error);
53};
54#endif