Index: trunk/psModules/src/imcombine/pmStackReject.c
===================================================================
--- trunk/psModules/src/imcombine/pmStackReject.c	(revision 26893)
+++ trunk/psModules/src/imcombine/pmStackReject.c	(revision 27004)
@@ -158,5 +158,5 @@
         if (!pmSubtractionConvolve(NULL, convRO, NULL, inRO, NULL, stride, 0, 0, 1.0, 0.0, 0.0,
                                    region, kernels, false, true)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to convolve mask image in region %d.", i);
+            psError(psErrorCodeLast(), false, "Unable to convolve mask image in region %d.", i);
             psFree(convRO);
             psFree(inRO);
@@ -170,5 +170,5 @@
         psImage *kernel = pmSubtractionKernelImage(kernels, 0.5, 0.5, false);
         if (!kernel) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to generate kernel image.");
+            psError(psErrorCodeLast(), false, "Unable to generate kernel image.");
             psFree(convRO);
             psFree(inRO);
@@ -283,5 +283,5 @@
                 } else if (!stackRejectGrow(target, source, kernels, numCols, numRows,
                                             i, xSubMax, j, ySubMax, poorFrac)) {
-                    psError(PS_ERR_UNKNOWN, false, "Unable to grow bad pixels.");
+                    psError(psErrorCodeLast(), false, "Unable to grow bad pixels.");
                     psFree(source);
                     psFree(target);
@@ -293,5 +293,5 @@
 
     if (!psThreadPoolWait(false)) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to grow bad pixels.");
+        psError(psErrorCodeLast(), false, "Unable to grow bad pixels.");
         psFree(source);
         psFree(target);
