tinyows 1.2.2
fe_error.c
Go to the documentation of this file.
1/*
2 Copyright (c) <2007-2012> <Barbara Philippot - Olivier Courtin>
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 IN THE SOFTWARE.
21*/
22
23
24#include <stdlib.h>
25#include <stdio.h>
26#include <assert.h>
27
28#include "../ows/ows.h"
29
30
31/*
32 * Call ows_error with the matching message
33 */
35{
36 assert(o);
37 assert(fe);
38
39 if (fe->error_code == FE_ERROR_FEATUREID) {
41 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Featureid must match layer.id", "FILTER");
42 } else if (fe->error_code == FE_ERROR_FILTER) {
44 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Filter parameter doesn't validate WFS Schema", "FILTER");
45 } else if (fe->error_code == FE_ERROR_BBOX) {
47 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Bbox must match xmin,ymin,xmax,ymax", "FILTER");
48 } else if (fe->error_code == FE_ERROR_PROPERTYNAME) {
50 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "PropertyName not available", "FILTER");
51 } else if (fe->error_code == FE_ERROR_GEOM_PROPERTYNAME) {
53 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Geometry PropertyName not available", "FILTER");
54 } else if (fe->error_code == FE_ERROR_UNITS) {
56 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Units not supported, use 'meters' or 'kilometers'", "FILTER");
57 } else if (fe->error_code == FE_ERROR_GEOMETRY) {
59 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Bad geometry", "FILTER");
60 } else if (fe->error_code == FE_ERROR_FID) {
62 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Only one allowed at once among FeatureId and GmlObjectId)", "FILTER");
63 } else if (fe->error_code == FE_ERROR_SRS) {
65 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "SrsName isn't valid", "FILTER");
66 } else if (fe->error_code == FE_ERROR_FUNCTION) {
68 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Unknown Function Name used in Filter", "FILTER");
69 } else if (fe->error_code == FE_ERROR_NAMESPACE) {
71 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "Filter Element contains incoherent XML Namespaces", "FILTER");
72 }
73}
74
75
76/*
77 * Fill a buffer with a human understable message
78 */
80{
81 buffer *result;
82
83 assert(o);
84 assert(fe);
85
86 result = buffer_init();
87
89 buffer_add_str(result, "Featureid must match layer.id");
90 else if (fe->error_code == FE_ERROR_FILTER)
91 buffer_add_str(result, "Filter parameter doesn't validate the filter.xsd schema. Check your xml");
92 else if (fe->error_code == FE_ERROR_BBOX)
93 buffer_add_str(result, "Bbox must match xmin,ymin,xmax,ymax");
94 else if (fe->error_code == FE_ERROR_PROPERTYNAME)
95 buffer_add_str(result, "PropertyName not available");
97 buffer_add_str(result, "Geometry PropertyName not available");
98 else if (fe->error_code == FE_ERROR_UNITS)
99 buffer_add_str(result, "Units not supported, use 'meters' or 'kilometers'");
100 else if (fe->error_code == FE_ERROR_GEOMETRY)
101 buffer_add_str(result, "Bad geometry");
102 else if (fe->error_code == FE_ERROR_FID)
103 buffer_add_str(result, "Only one type of identifier allowed (FeatureId or GmlObjectId)");
104 else if (fe->error_code == FE_ERROR_SRS)
105 buffer_add_str(result, "SrsName isn't valid");
106
107 return result;
108}
109
110
111/*
112 * vim: expandtab sw=4 ts=4
113 */
buffer * fill_fe_error(ows *o, filter_encoding *fe)
Definition fe_error.c:79
void fe_error(ows *o, filter_encoding *fe)
Definition fe_error.c:34
void buffer_add_str(buffer *buf, const char *str)
Definition buffer.c:254
void ows_error(ows *o, enum ows_error_code code, char *message, char *locator)
Definition ows_error.c:71
void filter_encoding_free(filter_encoding *fe)
Definition fe_filter.c:54
buffer * buffer_init()
Definition buffer.c:61
@ FE_ERROR_NAMESPACE
Definition ows_struct.h:339
@ FE_ERROR_UNITS
Definition ows_struct.h:334
@ FE_ERROR_FILTER
Definition ows_struct.h:330
@ FE_ERROR_PROPERTYNAME
Definition ows_struct.h:332
@ FE_ERROR_SRS
Definition ows_struct.h:337
@ FE_ERROR_GEOM_PROPERTYNAME
Definition ows_struct.h:333
@ FE_ERROR_BBOX
Definition ows_struct.h:331
@ FE_ERROR_GEOMETRY
Definition ows_struct.h:335
@ FE_ERROR_FUNCTION
Definition ows_struct.h:338
@ FE_ERROR_FEATUREID
Definition ows_struct.h:329
@ FE_ERROR_FID
Definition ows_struct.h:336
@ OWS_ERROR_INVALID_PARAMETER_VALUE
Definition ows_struct.h:159
enum fe_error_code error_code
Definition ows_struct.h:346

Generated for tinyows by doxygen 1.9.7