| 92 | } |
| 93 | |
| 94 | void writeError(void) |
| 95 | { |
| 96 | errorObj *ms_error = msGetErrorObj(); |
| 97 | |
| 98 | writeLog(MS_TRUE); |
| 99 | |
| 100 | if(!mapserv || !mapserv->map) { |
| 101 | msIO_printf("Content-type: text/html%c%c",10,10); |
| 102 | msIO_printf("<HTML>\n"); |
| 103 | msIO_printf("<HEAD><TITLE>MapServer Message</TITLE></HEAD>\n"); |
| 104 | msIO_printf("<!-- %s -->\n", msGetVersion()); |
| 105 | msIO_printf("<BODY BGCOLOR=\"#FFFFFF\">\n"); |
| 106 | msWriteErrorXML(stdout); |
| 107 | msIO_printf("</BODY></HTML>"); |
| 108 | if(mapserv) |
| 109 | msFreeMapServObj(mapserv); |
| 110 | msCleanup(); |
| 111 | exit(0); |
| 112 | } |
| 113 | |
| 114 | if((ms_error->code == MS_NOTFOUND) && (mapserv->map->web.empty)) { |
| 115 | /* msRedirect(mapserv->map->web.empty); */ |
| 116 | if(msReturnURL(mapserv, mapserv->map->web.empty, BROWSE) != MS_SUCCESS) { |
| 117 | msIO_printf("Content-type: text/html%c%c",10,10); |
| 118 | msIO_printf("<HTML>\n"); |
| 119 | msIO_printf("<HEAD><TITLE>MapServer Message</TITLE></HEAD>\n"); |
| 120 | msIO_printf("<!-- %s -->\n", msGetVersion()); |
| 121 | msIO_printf("<BODY BGCOLOR=\"#FFFFFF\">\n"); |
| 122 | msWriteErrorXML(stdout); |
| 123 | msIO_printf("</BODY></HTML>"); |
| 124 | } |
| 125 | } else { |
| 126 | if(mapserv->map->web.error) { |
| 127 | /* msRedirect(mapserv->map->web.error); */ |
| 128 | if(msReturnURL(mapserv, mapserv->map->web.error, BROWSE) != MS_SUCCESS) { |
| 129 | msIO_printf("Content-type: text/html%c%c",10,10); |
| 130 | msIO_printf("<HTML>\n"); |
| 131 | msIO_printf("<HEAD><TITLE>MapServer Message</TITLE></HEAD>\n"); |
| 132 | msIO_printf("<!-- %s -->\n", msGetVersion()); |
| 133 | msIO_printf("<BODY BGCOLOR=\"#FFFFFF\">\n"); |
| 134 | msWriteErrorXML(stdout); |
| 135 | msIO_printf("</BODY></HTML>"); |
| 136 | } |
| 137 | } else { |
| 138 | msIO_printf("Content-type: text/html%c%c",10,10); |
| 139 | msIO_printf("<HTML>\n"); |
| 140 | msIO_printf("<HEAD><TITLE>MapServer Message</TITLE></HEAD>\n"); |
| 141 | msIO_printf("<!-- %s -->\n", msGetVersion()); |
| 142 | msIO_printf("<BODY BGCOLOR=\"#FFFFFF\">\n"); |
| 143 | msWriteErrorXML(stdout); |
| 144 | msIO_printf("</BODY></HTML>"); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /* Clean-up (the following are not stored as part of the mapserv) */ |
| 149 | if(QueryItem) free(QueryItem); |
| 150 | if(QueryString) free(QueryString); |
| 151 | if(QueryLayer) free(QueryLayer); |
no test coverage detected