vibe.d: Finding out if currently in webinterface request
Seb
seb at wilzba.ch
Fri Aug 10 18:56:43 UTC 2018
On Friday, 10 August 2018 at 18:23:28 UTC, Johannes Loher wrote:
> On Friday, 10 August 2018 at 09:33:34 UTC, Timoses wrote:
>> On Thursday, 9 August 2018 at 21:59:24 UTC, Johannes Loher
>> wrote:
>>> I already posted this in the vibe.d forums
>>> (https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/58891/), but it seems, there is not a lot of activity over there, so I am cross posting this here:
>>>
>>> [...]
>>
>> Do you have some code segments boiled down to the problem?
>>
>> Are you using vibe.core.log?
>
> Yes, I am using vibe.core.log, but as mentioned, I want to
> implement my own logger. The gist of what I am trying to do is
> this:
>
> https://run.dlang.io/is/7qpJ6J
>
> This actually works the way it is, but it involves catch
> Throwable (actually AssertError would be enough) and this is
> bad. I would like to find a different solution.
You hit the assert of getRequestContext here:
https://github.com/vibe-d/vibe.d/blob/a9589d955f10bd076a67d47ace0c78cfd3aa8246/web/vibe/web/web.d#L871
However, I don't know of a way yet to check whether one is
currently in a request context from outside of vibe.web.web
(adding a method to do so to vibe.web.web which checks
`s_requestContext.req !is null` would probably help.)
More information about the Digitalmars-d-learn
mailing list