-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.cs
More file actions
27 lines (24 loc) · 758 Bytes
/
Controller.cs
File metadata and controls
27 lines (24 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Unosquare.Labs.EmbedIO;
using Unosquare.Labs.EmbedIO.Modules;
using Unosquare.Swan;
namespace EmbedStorage
{
public class Controller : WebApiController
{
public Controller(IHttpContext context) : base(context)
{
}
public Task<bool> Error(Exception e = null, CancellationToken cancellationToken = default)
{
Terminal.Error(e, e.Source, e.Message);
HttpContext.Response.StatusCode = 500;
return Ok(e == null ? "内部服务器错误" : e.StackTrace, "text/plain", Encoding.UTF8, false, cancellationToken);
}
}
}