Use angle::Result in allocation and math check macros.

Replace these with ANGLE_CHECK_*_ALLOC and ANGLE_CHECK_*_MATH depending
on the specific error type.

Bug: angleproject:2491
Change-Id: Ic4395101fe701c563ae2b92aa2c55c93b934a7de
Reviewed-on: https://chromium-review.googlesource.com/c/1262737
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 3567e29..c99cbe5 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -2618,6 +2618,15 @@
     mErrors.handleError(error);
 }
 
+void Context::handleError(GLenum errorCode,
+                          const char *message,
+                          const char *file,
+                          const char *function,
+                          unsigned int line)
+{
+    mErrors.handleError(errorCode, message, file, function, line);
+}
+
 // Get one of the recorded errors and clear its flag, if any.
 // [OpenGL ES 2.0.24] section 2.5 page 13.
 GLenum Context::getError()
@@ -7955,6 +7964,20 @@
     }
 }
 
+void ErrorSet::handleError(GLenum errorCode,
+                           const char *message,
+                           const char *file,
+                           const char *function,
+                           unsigned int line)
+{
+    // TODO(jmadill): Handle error directly instead of creating object. http://anglebug.com/2491
+    std::stringstream errorStream;
+    errorStream << "Front-end Error: " << gl::FmtHex(errorCode) << ", in " << file << ", "
+                << function << ":" << line << ". " << message;
+
+    handleError(gl::Error(errorCode, errorCode, errorStream.str()));
+}
+
 bool ErrorSet::empty() const
 {
     return mErrors.empty();