@@ -29,34 +29,32 @@ static if (isWeb)
2929 {
3030 try
3131 {
32- response.statusCode = error ? error.code : 500 ;
33- auto httpStatusExcepton = cast (HTTPStatusException)e;
32+ response.statusCode = (error ? error.code : 500 );
3433
35- if ((! httpStatusExcepton || httpStatusExcepton.status != HTTPStatus.NotFound) &&
36- (response.statusCode != 404 && response.statusCode != 200 )
37- )
38- {
39- // log ...
40- }
34+ auto httpStatusException = cast (HTTPStatusException)e;
4135
42- if (httpStatusExcepton && httpStatusExcepton.status == HTTPStatus.NotFound )
36+ if (httpStatusException )
4337 {
44- response.statusCode = 404 ;
45-
46- foreach (headerKey,headerValue; webConfig.defaultHeaders.notFound)
47- {
48- response.headers[headerKey] = headerValue;
49- }
38+ response.statusCode = httpStatusException.status;
5039
51- if (webSettings)
52- {
53- webSettings.onNotFound(request,response);
54- }
55- else
40+ if (httpStatusException.status == 404 )
5641 {
57- response.bodyWriter.write(" Not found ..." );
42+ foreach (headerKey,headerValue; webConfig.defaultHeaders.notFound)
43+ {
44+ response.headers[headerKey] = headerValue;
45+ }
46+
47+ if (webSettings)
48+ {
49+ webSettings.onNotFound(request,response);
50+ }
51+ else
52+ {
53+ response.bodyWriter.write(" Not found ..." );
54+ }
55+
56+ return ;
5857 }
59- return ;
6058 }
6159
6260 foreach (headerKey,headerValue; webConfig.defaultHeaders.error)
@@ -98,7 +96,7 @@ static if (isWeb)
9896 {
9997 try
10098 {
101- response.statusCode = error ? error.code : 500 ;
99+ response.statusCode = ( error ? error.code : 500 ) ;
102100
103101 if (error && error.code == 404 )
104102 {
0 commit comments