alef-backend-csharp 0.16.21

C# (P/Invoke) backend for alef
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    private static Exception GetLastError()
    {
        var code = NativeMethods.LastErrorCode();
        var ctxPtr = NativeMethods.LastErrorContext();
        var message = Marshal.PtrToStringUTF8(ctxPtr) ?? "Unknown error";
{%- if has_invalid_input_variant %}
        if (code == 1) return new InvalidInputException(message);
{%- endif %}
{%- if has_base_error %}
{%- for line in variant_dispatch_lines %}
{{ line }}
{%- endfor %}
        if (code == 2) return new {{ base_exception_class }}(message);
{%- endif %}
        return new {{ exception_name }}(code, message);
    }