summaryrefslogtreecommitdiffstats
path: root/net/websockets/websocket_errors.cc
blob: 0814dab4aeedd5ec9e60ff5397a7c7600a4738c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/websockets/websocket_errors.h"

#include "base/logging.h"

namespace net {

Error WebSocketErrorToNetError(WebSocketError error) {
  switch (error) {
    case WEB_SOCKET_OK:
      return OK;
    case WEB_SOCKET_ERR_PROTOCOL_ERROR:
      return ERR_WS_PROTOCOL_ERROR;
    case WEB_SOCKET_ERR_MESSAGE_TOO_BIG:
      return ERR_MSG_TOO_BIG;
    default:
      NOTREACHED();
      return ERR_UNEXPECTED;
  }
}

}  // namespace net