liquid_feedback_frontend
annotate env/util/api_error.lua @ 1413:3dbfac432576
Fixed endless loop while sending notification when not issue is created yet
| author | bsw |
|---|---|
| date | Sun Aug 26 13:38:14 2018 +0200 (2018-08-26) |
| parents | 32cc544d5a5b |
| children |
| rev | line source |
|---|---|
| bsw/jbe@1309 | 1 function util.api_error(status_code, status_text, error_code, error_description) |
| bsw/jbe@1309 | 2 slot.set_layout(nil, "application/json") |
| bsw/jbe@1309 | 3 request.set_status(status_code, status_text) |
| bsw/jbe@1309 | 4 if status_code == 401 then |
| bsw/jbe@1309 | 5 request.add_header("WWW-Authenticate", "Bearer error=\"" .. error_code .. "\", error_description=\"" .. error_description .. "\"") |
| bsw/jbe@1309 | 6 end |
| bsw/jbe@1309 | 7 slot.put_into("data", json.export(json.object{ |
| bsw/jbe@1309 | 8 error = error_code, |
| bsw/jbe@1309 | 9 error_description = error_description |
| bsw/jbe@1309 | 10 })) |
| bsw/jbe@1309 | 11 return false |
| bsw/jbe@1309 | 12 end |