Index: trunk/pswarp/src/pswarpDefineSkycell.c
===================================================================
--- trunk/pswarp/src/pswarpDefineSkycell.c	(revision 21323)
+++ trunk/pswarp/src/pswarpDefineSkycell.c	(revision 27096)
@@ -47,5 +47,5 @@
     }
     if (infiles->n != 1) {
-        psError(PS_ERR_IO, false, "Found n == %ld files in %s in arguments\n", infiles->n, argname);
+        psError(PSWARP_ERR_CONFIG, false, "Found n == %ld files in %s in arguments\n", infiles->n, argname);
         return false;
     }
@@ -54,5 +54,5 @@
     psString realName = pmConfigConvertFilename (infiles->data[0], config, false, false);
     if (!realName) {
-        psError(PS_ERR_IO, false, "Failed to convert file name %s\n", (char *) infiles->data[0]);
+        psError(psErrorCodeLast(), false, "Failed to convert file name %s\n", (char *) infiles->data[0]);
         return false;
     }
@@ -61,5 +61,5 @@
     fits = psFitsOpen (realName, "r");
     if (!fits) {
-        psError(PS_ERR_IO, false, "Failed to open file %s\n", realName);
+        psError(psErrorCodeLast(), false, "Failed to open file %s\n", realName);
         psFree (realName);
         return false;
@@ -67,5 +67,5 @@
     phu = psFitsReadHeader (NULL, fits);
     if (!phu) {
-        psError(PS_ERR_IO, false, "Failed to read file header %s\n", realName);
+        psError(psErrorCodeLast(), false, "Failed to read file header %s\n", realName);
         psFree (realName);
         return false;
@@ -87,5 +87,5 @@
     format = pmConfigCameraFormatFromHeader (NULL, NULL, NULL, skyConfig, phu, false);
     if (!format) {
-        psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", realName);
+        psError(psErrorCodeLast(), false, "Failed to read CCD format from %s\n", realName);
         psFree(phu);
         psFree (realName);
@@ -100,5 +100,5 @@
     fpa = pmFPAConstruct (skyConfig->camera, skyConfig->cameraName);
     if (!fpa) {
-        psError(PS_ERR_IO, false, "Failed to construct FPA from %s", realName);
+        psError(psErrorCodeLast(), false, "Failed to construct FPA from %s", realName);
         psFree (realName);
         return false;
@@ -110,5 +110,5 @@
     file = pmFPAfileDefineInput (skyConfig, fpa, NULL, filename);
     if (!file) {
-        psError(PS_ERR_IO, false, "file %s not defined\n", filename);
+        psError(psErrorCodeLast(), false, "file %s not defined\n", filename);
         psFree(phu);
         psFree(fpa);
@@ -126,5 +126,5 @@
     file->fileLevel = pmFPAPHULevel(format);
     if (file->fileLevel == PM_FPA_LEVEL_NONE) {
-        psError(PS_ERR_IO, true, "Unable to determine file level for %s\n", file->name);
+        psError(PSWARP_ERR_CONFIG, true, "Unable to determine file level for %s\n", file->name);
         psFree(phu);
         psFree(fpa);
@@ -137,5 +137,5 @@
     pmFPAview *view = pmFPAAddSourceFromHeader (fpa, phu, format);
     if (!view) {
-        psError(PS_ERR_IO, false, "Unable to determine source for %s", file->name);
+        psError(psErrorCodeLast(), false, "Unable to determine source for %s", file->name);
         psFree(phu);
         psFree (fpa);
