1//
2// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// Error.cpp: Implements the gl::Error class which encapsulates an OpenGL error
8// and optional error message.
9
10#include "libGLESv2/Error.h"
11
12#include "common/angleutils.h"
13
14#include <cstdarg>
15
16namespace gl
17{
18
19Error::Error(GLenum errorCode)
20    : mCode(errorCode),
21      mMessage()
22{
23}
24
25Error::Error(GLenum errorCode, const char *msg, ...)
26    : mCode(errorCode),
27      mMessage()
28{
29    va_list vararg;
30    va_start(vararg, msg);
31    mMessage = FormatString(msg, vararg);
32    va_end(vararg);
33}
34
35Error::Error(const Error &other)
36    : mCode(other.mCode),
37      mMessage(other.mMessage)
38{
39}
40
41Error &Error::operator=(const Error &other)
42{
43    mCode = other.mCode;
44    mMessage = other.mMessage;
45    return *this;
46}
47
48}
49