liquid_feedback_frontend
view env/util/api_error.lua @ 1412:b42bea44f26c
Sorting unit names in registration form
| author | bsw | 
|---|---|
| date | Mon Aug 20 18:43:17 2018 +0200 (2018-08-20) | 
| parents | 32cc544d5a5b | 
| children | 
 line source
     1 function util.api_error(status_code, status_text, error_code, error_description)
     2   slot.set_layout(nil, "application/json")
     3   request.set_status(status_code, status_text)
     4   if status_code == 401 then
     5     request.add_header("WWW-Authenticate", "Bearer error=\"" .. error_code .. "\", error_description=\"" .. error_description .. "\"")
     6   end
     7   slot.put_into("data", json.export(json.object{
     8     error = error_code,
     9     error_description = error_description
    10   }))
    11   return false
    12 end
