On Wed, 4 Dec 2024 08:43:55 +0100, Sönke Ludwig wrote:
Am 03.12.2024 um 20:26 schrieb Curtis:
On Tue, 3 Dec 2024 18:20:17 +0100, Sönke Ludwig wrote:
(...)
Thanks! The server I'm connecting to is using a Let's Encrypt cert so
I've updated my code to:settings.tlsContextSetup = (scope ctx) { ctx.useTrustedCertificateFile("/etc/ssl/certs/ISRG_Root_X1.pem"); };
and have left
TLSPeerValidationMode
alone since it it's a public
certificate.Now I'm running into a D error where it's saying my void delegate
function can't be implicitly converted tovoid delegate nothrow
:Error: cannot implicitly convert expression '__lambda5' of type 'void delegate(TLSContext ctx) @safe' to 'void delegate(TLSContext ctx) nothrow @safe'
I tried changing the signature to
(ctx) nothrow {...
andvoid <br>delegate() f(ctx) nothrow
but the compiler complains about syntax errors.Try wrapping the
useTrustedCertificateFile
call in a try-catch:settings.tlsContextSetup = (scope ctx) { try ctx.useTrustedCertificateFile("/etc/ssl/certs/ ISRG_Root_X1.pem"); catch (Exception e) { import vibe.core.log : logException; logException(e, "Failed to load trusted certificate store"); } };
Looking at the API an implementation, I actually wonder why the callback
needs to benothrow
at all. It looks like it would actually make a lot
of sense to let it throw on error.
I added a try-catch and was able to get the app complied and working.
Appreciate the help!