static void fillZone(const DNSName& zonename, HttpResponse* resp, bool doRRSets) {
UeberBackend B;
DomainInfo di;
- if(!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
+ if(!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
DNSSECKeeper dk(&B);
Json::object doc = getZoneInfo(di, &dk);
UeberBackend B;
DomainInfo di;
- if (!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
if (req->method == "GET") {
map<string, vector<string> > md;
UeberBackend B;
DomainInfo di;
- if (!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
string kind = req->parameters["kind"];
UeberBackend B;
DNSSECKeeper dk(&B);
DomainInfo di;
- if (!B.getDomainInfo(zonename, di))
- throw HttpBadRequestException();
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
int inquireKeyId = -1;
if (req->parameters.count("key_id")) {
static void apiServerZoneDetail(HttpRequest* req, HttpResponse* resp) {
DNSName zonename = apiZoneIdToName(req->parameters["id"]);
+ UeberBackend B;
+ DomainInfo di;
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
+
if(req->method == "PUT" && !::arg().mustDo("api-readonly")) {
// update domain settings
- UeberBackend B;
- DomainInfo di;
- if(!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
updateDomainSettingsFromDocument(B, di, zonename, req->json());
}
else if(req->method == "DELETE" && !::arg().mustDo("api-readonly")) {
// delete domain
- UeberBackend B;
- DomainInfo di;
- if(!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
-
if(!di.backend->deleteDomain(zonename))
throw ApiException("Deleting domain '"+zonename.toString()+"' failed: backend delete failed/unsupported");
fillZone(zonename, resp, shouldDoRRSets(req));
return;
}
-
throw HttpMethodNotAllowedException();
}
UeberBackend B;
DomainInfo di;
- if(!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
DNSResourceRecord rr;
SOAData sd;
UeberBackend B;
DomainInfo di;
- if(!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
if(di.masters.empty())
throw ApiException("Domain '"+zonename.toString()+"' is not a slave domain (or has no master defined)");
UeberBackend B;
DomainInfo di;
- if(!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
if(!Communicator.notifyDomain(zonename))
throw ApiException("Failed to add to the queue - see server log");
UeberBackend B;
DomainInfo di;
- if(!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
DNSSECKeeper dk(&B);
UeberBackend B;
DomainInfo di;
DNSName zonename = apiZoneIdToName(req->parameters["id"]);
- if (!B.getDomainInfo(zonename, di))
- throw ApiException("Could not find domain '"+zonename.toString()+"'");
+ if (!B.getDomainInfo(zonename, di)) {
+ throw HttpNotFoundException();
+ }
vector<DNSResourceRecord> new_records;
vector<Comment> new_comments;