<commit_before>﻿
// Copyright (C) 2015 <NAME>
// 
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
// USA

using System;

namespace OpenGL
{
	/// <summary>
	/// Exception thrown by Gl class.
	/// </summary>
	public class GlException : KhronosException
	{
		#region Constructors

		/// <summary>
		/// Construct a GlException.
		/// </summary>
		/// <param name="errorCode">
		/// A <see cref="ErrorCode"/> that specifies the error code.
		/// </param>
		public GlException(ErrorCode errorCode) :
			base((int)errorCode, GetErrorMessage((int)errorCode))
		{

		}

		/// <summary>
		/// Construct a GlException.
		/// </summary>
		/// <param name="errorCode">
		/// A <see cref="ErrorCode"/> that specifies the error code.
		/// </param>
		/// <param name="message">
		/// A <see cref="String"/> that specifies the exception message.
		/// </param>
		public GlException(ErrorCode errorCode, String message) :
			base((int)errorCode, message)
		{

		}

		/// <summary>
		/// Construct a GlException.
		/// </summary>
		/// <param name="errorCode">
		/// A <see cref="ErrorCode"/> that specifies the error code.
		/// </param>
		/// <param name="message">
		/// A <see cref="String"/> that specifies the exception message.
		/// </param>
		/// <param name="innerException">
		/// The <see cref="Exception"/> wrapped by this Exception.
		/// </param>
		public GlException(ErrorCode errorCode, String message, Exception innerException) :
			base((int)errorCode, message, innerException)
		{

		}

		#endregion

		#region Error Messages

		/// <summary>
		/// Returns a description of the error code.
		/// </summary>
		/// <param name="errorCode">
		/// A <see cref="ErrorCode"/> that specifies the error code.
		/// </param>
		/// <returns>
		/// It returns a description of <paramref name="errorCode"/>, asssuming that is a value returned
		/// by <see cref="Egl.GetError"/>.
		/// </returns>
		private static string GetErrorMessage(int errorCode)
		{
			switch (errorCode) {

				default:
					return (String.Format("unknown error code 0x{0}", errorCode.ToString("X8")));
				case Gl.NO_ERROR:
					return ("no error");
				case Gl.INVALID_ENUM:
					return ("invalid enumeration");
				case Gl.INVALID_FRAMEBUFFER_OPERATION:
					return ("invalid framebuffer operation");
				case Gl.INVALID_OPERATION:
					return ("invalid operation");
				case Gl.INVALID_VALUE:
					return ("invalid value");
				case Gl.OUT_OF_MEMORY:
					return ("out of memory");
				case Gl.STACK_OVERFLOW:
					return ("stack overflow");
				case Gl.STACK_UNDERFLOW:
					return ("stack underflow");

				// GL_ARB_imaging
				case Gl.TABLE_TOO_LARGE:
					return ("table too large");
				// GL_EXT_texture
				case Gl.TEXTURE_TOO_LARGE_EXT:
					return ("texture too large");
			}
		}

		#endregion
	}
}
<commit_msg>Exception cannot be instantiated outside from OpenGL.Net.<commit_after>﻿
// Copyright (C) 2015 <NAME>
// 
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
// USA

using System;

namespace OpenGL
{
	/// <summary>
	/// Exception thrown by Gl class.
	/// </summary>
	public class GlException : KhronosException
	{
		#region Constructors

		/// <summary>
		/// Construct a GlException.
		/// </summary>
		/// <param name="errorCode">
		/// A <see cref="ErrorCode"/> that specifies the error code.
		/// </param>
		internal GlException(ErrorCode errorCode) :
			base((int)errorCode, GetErrorMessage(errorCode))
		{

		}

		/// <summary>
		/// Construct a GlException.
		/// </summary>
		/// <param name="errorCode">
		/// A <see cref="ErrorCode"/> that specifies the error code.
		/// </param>
		/// <param name="message">
		/// A <see cref="String"/> that specifies the exception message.
		/// </param>
		internal GlException(ErrorCode errorCode, String message) :
			base((int)errorCode, message)
		{

		}

		/// <summary>
		/// Construct a GlException.
		/// </summary>
		/// <param name="errorCode">
		/// A <see cref="ErrorCode"/> that specifies the error code.
		/// </param>
		/// <param name="message">
		/// A <see cref="String"/> that specifies the exception message.
		/// </param>
		/// <param name="innerException">
		/// The <see cref="Exception"/> wrapped by this Exception.
		/// </param>
		internal GlException(ErrorCode errorCode, String message, Exception innerException) :
			base((int)errorCode, GetErrorMessage(errorCode) + message, innerException)
		{

		}

		#endregion

		#region Error Messages

		/// <summary>
		/// Returns a description of the error code.
		/// </summary>
		/// <param name="errorCode">
		/// A <see cref="ErrorCode"/> that specifies the error code.
		/// </param>
		/// <returns>
		/// It returns a description of <paramref name="errorCode"/>, asssuming that is a value returned
		/// by <see cref="Egl.GetError"/>.
		/// </returns>
		private static string GetErrorMessage(ErrorCode errorCode)
		{
			switch (errorCode) {

				default:
					return (String.Format("unknown error code 0x{0}", errorCode.ToString("X8")));
				case ErrorCode.NoError:
					return ("no error");
				case ErrorCode.InvalidEnum:
					return ("invalid enumeration");
				case ErrorCode.InvalidFramebufferOperation:
					return ("invalid framebuffer operation");
				case ErrorCode.InvalidOperation:
					return ("invalid operation");
				case ErrorCode.InvalidValue:
					return ("invalid value");
				case ErrorCode.OutOfMemory:
					return ("out of memory");
				case ErrorCode.StackOverflow:
					return ("stack overflow");
				case ErrorCode.StackUnderflow:
					return ("stack underflow");

				// GL_ARB_imaging
				case ErrorCode.TableTooLarge:
					return ("table too large");
				// GL_EXT_texture
				case ErrorCode.TextureTooLargeExt:
					return ("texture too large");
			}
		}

		#endregion
	}
}

{'fraction_non_alphanumeric': 0.1365750528541226, 'fraction_numerical': 0.005637773079633545, 'mean_word_length': 2.9488035614913746, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3917056', 'n_tokens_mistral': 2350, 'n_tokens_neox': 2010, 'n_words': 714}