Update Program, ProgramBinary and HLSLCompiler to use Error objects.

BUG=angle:520

Change-Id: Ibbe8c95780fecfb68f4558e99e3a761107da6aee
Reviewed-on: https://chromium-review.googlesource.com/220790
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index 575d250..4532889 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -3654,7 +3654,12 @@
             }
         }
 
-        context->linkProgram(program);
+        gl::Error error = context->linkProgram(program);
+        if (error.isError())
+        {
+            context->recordError(error);
+            return;
+        }
     }
 }
 
@@ -8402,9 +8407,10 @@
             return;
         }
 
-        if (!programBinary->save(binaryFormat, binary, bufSize, length))
+        gl::Error error = programBinary->save(binaryFormat, binary, bufSize, length);
+        if (error.isError())
         {
-            context->recordError(gl::Error(GL_INVALID_OPERATION));
+            context->recordError(error);
             return;
         }
     }
@@ -8433,7 +8439,12 @@
             return;
         }
 
-        context->setProgramBinary(program, binaryFormat, binary, length);
+        gl::Error error = context->setProgramBinary(program, binaryFormat, binary, length);
+        if (error.isError())
+        {
+            context->recordError(error);
+            return;
+        }
     }
 }