Skip to content

Log exceptions when thrown #17

@ArthaTi

Description

@ArthaTi

Currently, if an exception is thrown in a user-provided handler, it will get silenced. The only trace of the exception will be the "500 Server Error" page and the error message nor stack trace are not recoverable.

The suggestion is to make them possible to log, and add a new option eg. printExceptions, preferably on by default. For example, handleRouteCatch could be expanded to include a stderr.writeln call:

	private void handleRouteCatch(ref HandleResult result, AsyncTCPConnection client, ServerRequest req, ServerResponse res) {
		try this.server.router.handle(this.server.options, result, client, req, res);
		catch(Exception ex) {
			import std.stdio;
			res.status = StatusCodes.internalServerError;
			stderr.writeln(ex);
		}
	}

Can self-assign.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions