Exemple #1
0
        public static async Task DieOnErrorAsync(HttpResponse res, TextWriter output, Encoder encoder, string error, string message)
        {
            var root   = encoder.CreateRoot();
            var result = encoder.AddContainer(root, "Result");

            encoder.AddBoolean(result, "Success", false);
            Appixia.Engine.Mediums.Array details = encoder.AddArray(result, "Detail");
            var detail = encoder.AddContainerToArray(details);

            encoder.AddString(detail, "Error", error);
            encoder.AddString(detail, "Message", message);
            await encoder.RenderAsync(res, output, root);

            await output.FlushAsync();

            throw new DieException();
        }