Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
87 lines (80 loc) · 4.03 KB

File metadata and controls

87 lines (80 loc) · 4.03 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AustinHarris.JsonRpc
{
/// <summary>
/// The PreProcessHandler is called after the request has been parsed and prior to calling the associated method on the JsonRpcService.
/// If any non-null result is returned from the PreProcessHandler, the operation is aborted and the error is returned to the caller.
/// </summary>
/// <param name="request">The jsonRpc Request that is pending processing.</param>
/// <param name="context">The context associated with this request</param>
/// <returns>Any non-null result causes the operation to be aborted, and the JsonRpcException is returned to the caller.</returns>
public delegate JsonRpcException PreProcessHandler(JsonRequest request, object context);
/// <summary>
/// Global configurations for JsonRpc
/// </summary>
public static class Config
{
/// <summary>
/// Sets the the PreProcessing Handler on the default session.
/// </summary>
/// <param name="handler"></param>
public static void SetPreProcessHandler(PreProcessHandler handler)
{
Handler.DefaultHandler.SetPreProcessHandler(handler);
}
/// <summary>
/// Sets the PreProcessing Handler on a specific session
/// </summary>
/// <param name="sessionId"></param>
/// <param name="handler"></param>
public static void SetBeforeProcessHandler(string sessionId, PreProcessHandler handler)
{
Handler.GetSessionHandler(sessionId).SetPreProcessHandler(handler);
}
/// <summary>
/// For exceptions thrown after the routed method has been called.
/// Allows you to specify an error handler that will be invoked prior to returning the JsonResponse to the client.
/// You are able to modify the error that is returned inside the provided handler.
/// </summary>
/// <param name="handler"></param>
public static void SetErrorHandler(Func<JsonRequest, JsonRpcException, JsonRpcException> handler)
{
Handler.DefaultHandler.SetErrorHandler(handler);
}
/// <summary>
/// For exceptions thrown after the routed method has been called.
/// Allows you to specify an error handler that will be invoked prior to returning the JsonResponse to the client.
/// You are able to modify the error that is returned inside the provided handler.
/// </summary>
/// <param name="sessionId"></param>
/// <param name="handler"></param>
public static void SetErrorHandler(string sessionId, Func<JsonRequest, JsonRpcException, JsonRpcException> handler)
{
Handler.GetSessionHandler(sessionId).SetErrorHandler(handler);
}
/// <summary>
/// For exceptions thrown during parsing and prior to a routed method being called.
/// Allows you to specify an error handler that will be invoked prior to returning the JsonResponse to the client.
/// You are able to modify the error that is returned inside the provided handler.
/// </summary>
/// <param name="handler"></param>
public static void SetParseErrorHandler(Func<string,JsonRpcException,JsonRpcException> handler)
{
Handler.DefaultHandler.SetParseErrorHandler(handler);
}
/// <summary>
/// For exceptions thrown during parsing and prior to a routed method being called.
/// Allows you to specify an error handler that will be invoked prior to returning the JsonResponse to the client.
/// You are able to modify the error that is returned inside the provided handler.
/// </summary>
/// <param name="sessionId"></param>
/// <param name="handler"></param>
public static void SetParseErrorHandler(string sessionId, Func<string, JsonRpcException, JsonRpcException> handler)
{
Handler.GetSessionHandler(sessionId).SetParseErrorHandler(handler);
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.