websocket_errors.cc revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "net/websockets/websocket_errors.h"
6
7#include "base/logging.h"
8
9namespace net {
10
11Error WebSocketErrorToNetError(WebSocketError error) {
12  switch (error) {
13    case WEB_SOCKET_OK:
14      return OK;
15    case WEB_SOCKET_ERR_PROTOCOL_ERROR:
16      return ERR_WS_PROTOCOL_ERROR;
17    case WEB_SOCKET_ERR_MESSAGE_TOO_BIG:
18      return ERR_MSG_TOO_BIG;
19    default:
20      NOTREACHED();
21      return ERR_UNEXPECTED;
22  }
23}
24
25}  // namespace net
26