mirror of https://github.com/adamdruppe/arsd.git
fix bug added with wrong continue
This commit is contained in:
parent
7150cd81f4
commit
682ddd0563
20
cgi.d
20
cgi.d
|
@ -6296,7 +6296,7 @@ class WorkerThread : Thread {
|
|||
// might have beat us to it, but the wakeup event thundered our herds.
|
||||
try
|
||||
sn = listener.accept(); // don't need to do the acceptCancelable here since the epoll checks it better
|
||||
catch(SocketAcceptException e) { continue; }
|
||||
catch(SocketAcceptException e) { continue outer; }
|
||||
|
||||
cloexec(sn);
|
||||
if(lcm.tcp) {
|
||||
|
@ -6310,11 +6310,13 @@ class WorkerThread : Thread {
|
|||
|
||||
dg(sn);
|
||||
continue outer;
|
||||
} else {
|
||||
// writeln(events[idx].data.ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if(cast(size_t) events[idx].data.ptr < 1024) {
|
||||
throw new Exception("this doesn't look like a fiber pointer...");
|
||||
throw arsd.core.ArsdException!"this doesn't look like a fiber pointer... "(cast(size_t) events[idx].data.ptr);
|
||||
}
|
||||
auto fiber = cast(CgiFiber) events[idx].data.ptr;
|
||||
fiber.proceed();
|
||||
|
@ -9921,10 +9923,24 @@ html", true, true);
|
|||
case "html":
|
||||
presentExceptionAsHtml(cgi, t, meta);
|
||||
break;
|
||||
case "json":
|
||||
presentExceptionAsJsonImpl(cgi, t);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
private void presentExceptionAsJsonImpl()(Cgi cgi, Throwable t) {
|
||||
cgi.setResponseStatus("500 Internal Server Error");
|
||||
cgi.setResponseContentType("application/json");
|
||||
import arsd.jsvar;
|
||||
var v = var.emptyObject;
|
||||
v.type = typeid(t).toString;
|
||||
v.msg = t.msg;
|
||||
v.fullString = t.toString();
|
||||
cgi.write(v.toJson(), true);
|
||||
}
|
||||
|
||||
|
||||
/++
|
||||
If you override this, you will need to cast the exception type `t` dynamically,
|
||||
|
|
Loading…
Reference in New Issue