gardners / surveysystem

System for on-line and off-grid survey preparation and submissions
BSD 2-Clause "Simplified" License
2 stars 0 forks source link

backend: error handling, answer validation flags #414

Open RoboSparrow opened 3 years ago

RoboSparrow commented 3 years ago

1) fcgi: improve variety of fastcgi error responses err (replaces #134, 500 internal error instead 400 with error description), use http_json_error in fcgi helper functions (request_load_answer()) instead throwing a general error from page handler

Example, addanswer prints error Could not load answer.. regardless of the answer arg missing, empty, or malformed internal mem error

2) extend LOG_ERROR*with a error codes and a customstrerror()`

3) implement answer.flags validation (replaces #342)

validation cascade

  1. cgi: request && kvalid_ should do only simple checks (is set? not empty? type?)
  2. serialiser pattern: should check patterns (count separators?)
  3. serilaliser values: based on serilisers and extend current type check (sha_length?, comma separated length? comma separated types?, allow negative?)
  4. question validation: option exists? flag validation

342: prepared some (disabled) tests invalid_request_return_codes.test

RoboSparrow commented 3 years ago

description from #342

related, #50, #223, #341

This should be kept as simple as possible, extended validation as suggested in #50 should be part of the python controller response

backend validation (return 400)

value set: FLAG_MANDATORY value in choices min_value != max_value and min >= value =< max

Flags

remove format flags for time unit, this is flagged by question type and time unit of seconds across all fields

remove flag_hidden? (qtype HIDDEN)