/* SPDX-License-Identifier: LGPL-2.1-or-later OR MPL-2.0
Copyright (c) 2024 DorotaC
*/
/*! OpenGL errors.
*/
use gl;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("Any")]
Any(u32),
}
pub fn check<T>(result: T) -> Result<T, Error> {
let err = unsafe { gl::GetError() };
if err == gl::NO_ERROR {
Ok(result)
} else {
Err(Error::Any(err))
}
}