public static ZoneSpecification from( ZoneSpecification other, HandleUncaughtErrorHandler handleUncaughtError = null, RunHandler run = null, RunUnaryHandler runUnary = null, RunBinaryHandler runBinary = null, RegisterCallbackHandler registerCallback = null, RegisterUnaryCallbackHandler registerUnaryCallback = null, RegisterBinaryCallbackHandler registerBinaryCallback = null, ErrorCallbackHandler errorCallback = null, ScheduleMicrotaskHandler scheduleMicrotask = null, CreateTimerHandler createTimer = null, CreatePeriodicTimerHandler createPeriodicTimer = null, PrintHandler print = null, ForkHandler fork = null) { return(new ZoneSpecification( handleUncaughtError: handleUncaughtError ?? other.handleUncaughtError, run: run ?? other.run, runUnary: runUnary ?? other.runUnary, runBinary: runBinary ?? other.runBinary, registerCallback: registerCallback ?? other.registerCallback, registerUnaryCallback: registerUnaryCallback ?? other.registerUnaryCallback, registerBinaryCallback: registerBinaryCallback ?? other.registerBinaryCallback, errorCallback: errorCallback ?? other.errorCallback, scheduleMicrotask: scheduleMicrotask ?? other.scheduleMicrotask, createTimer: createTimer ?? other.createTimer, createPeriodicTimer: createPeriodicTimer ?? other.createPeriodicTimer, print: print ?? other.print, fork: fork ?? other.fork )); }
private void BuildRuntimePipeline() { #if BCL || BCL45 var httpRequestFactory = new HttpWebRequestFactory(); var httpHandler = new HttpHandler <Stream>(httpRequestFactory, this); #elif UNITY IHttpRequestFactory <string> httpRequestFactory = null; HttpHandler <string> httpHandler = null; if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW) { httpRequestFactory = new UnityWwwRequestFactory(); httpHandler = new HttpHandler <string>(httpRequestFactory, this); } else { httpRequestFactory = new UnityWebRequestFactory(); httpHandler = new HttpHandler <string>(httpRequestFactory, this); } #else var httpRequestFactory = new HttpRequestMessageFactory(this.Config); var httpHandler = new HttpHandler <System.Net.Http.HttpContent>(httpRequestFactory, this); #endif var preMarshallHandler = new CallbackHandler(); preMarshallHandler.OnPreInvoke = this.ProcessPreRequestHandlers; var postMarshallHandler = new CallbackHandler(); postMarshallHandler.OnPreInvoke = this.ProcessRequestHandlers; var postUnmarshallHandler = new CallbackHandler(); postUnmarshallHandler.OnPostInvoke = this.ProcessResponseHandlers; var errorCallbackHandler = new ErrorCallbackHandler(); errorCallbackHandler.OnError = this.ProcessExceptionHandlers; // Build default runtime pipeline. this.RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler> { httpHandler, new Unmarshaller(this.SupportResponseLogging), new ErrorHandler(_logger), postUnmarshallHandler, new Signer(), new CredentialsRetriever(this.Credentials), new RetryHandler(new DefaultRetryPolicy(this.Config)), postMarshallHandler, new EndpointResolver(), new Marshaller(), preMarshallHandler, errorCallbackHandler, new MetricsHandler() #if UNITY , new ThreadPoolExecutionHandler(10) //remove the hardcoded to unity config #endif }, _logger ); CustomizeRuntimePipeline(this.RuntimePipeline); }
public ZoneSpecification( HandleUncaughtErrorHandler handleUncaughtError = null, RunHandler run = null, RunUnaryHandler runUnary = null, RunBinaryHandler runBinary = null, RegisterCallbackHandler registerCallback = null, RegisterUnaryCallbackHandler registerUnaryCallback = null, RegisterBinaryCallbackHandler registerBinaryCallback = null, ErrorCallbackHandler errorCallback = null, ScheduleMicrotaskHandler scheduleMicrotask = null, CreateTimerHandler createTimer = null, CreatePeriodicTimerHandler createPeriodicTimer = null, PrintHandler print = null, ForkHandler fork = null) { this.handleUncaughtError = handleUncaughtError; this.run = run; this.runUnary = runUnary; this.runBinary = runBinary; this.registerCallback = registerCallback; this.registerUnaryCallback = registerUnaryCallback; this.registerBinaryCallback = registerBinaryCallback; this.errorCallback = errorCallback; this.scheduleMicrotask = scheduleMicrotask; this.createTimer = createTimer; this.createPeriodicTimer = createPeriodicTimer; this.print = print; this.fork = fork; }
public static void Error(string txt) { if (!IsEnabled()) { return; } MelonLogger.Internal_Error("DEBUG", txt); ErrorCallbackHandler?.Invoke(txt); }
protected virtual void BuildRuntimePipeline() { #if !AWSSDK_UNITY #if BCL || BCL45 var httpRequestFactory = new HttpWebRequestFactory(); var httpHandler = new HttpHandler <Stream>(httpRequestFactory, this); #else var httpRequestFactory = new HttpRequestMessageFactory(this.Config); var httpHandler = new HttpHandler <System.Net.Http.HttpContent>(httpRequestFactory, this); #endif var preMarshallHandler = new CallbackHandler(); preMarshallHandler.OnPreInvoke = this.ProcessPreRequestHandlers; var postMarshallHandler = new CallbackHandler(); postMarshallHandler.OnPreInvoke = this.ProcessRequestHandlers; var postUnmarshallHandler = new CallbackHandler(); postUnmarshallHandler.OnPostInvoke = this.ProcessResponseHandlers; var errorCallbackHandler = new ErrorCallbackHandler(); errorCallbackHandler.OnError = this.ProcessExceptionHandlers; // Build default runtime pipeline. this.RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler> { httpHandler, new Unmarshaller(this.SupportResponseLogging), new ErrorHandler(_logger), postUnmarshallHandler, new Signer(), new CredentialsRetriever(this.Credentials), new RetryHandler(new DefaultRetryPolicy(this.Config.MaxErrorRetry)), postMarshallHandler, new EndpointResolver(), new Marshaller(), preMarshallHandler, errorCallbackHandler, new MetricsHandler() }, _logger ); CustomizeRuntimePipeline(this.RuntimePipeline); #endif }
public override AsyncError errorCallback(Exception error) { if (error == null) { throw new ArgumentNullException(nameof(error)); } var implementation = _errorCallback; _Zone implementationZone = implementation.zone; if (ReferenceEquals(implementationZone, async_._rootZone)) { return(null); } ZoneDelegate parentDelegate = async_._parentDelegate(implementationZone); ErrorCallbackHandler handler = implementation.function; return(handler(implementationZone, parentDelegate, this, error)); }
public AsyncError errorCallback(Zone zone, Exception error) { if (error == null) { throw new ArgumentNullException(nameof(error)); } var implementation = _delegationTarget._errorCallback; _Zone implZone = implementation.zone; if (ReferenceEquals(implZone, async_._rootZone)) { return(null); } ErrorCallbackHandler handler = implementation.function; return(handler(implZone, async_._parentDelegate(implZone), zone, error)); }
protected override void BuildRuntimePipeline() { var httpRequestFactory = new UnityWebRequestFactory(); var httpHandler = new HttpHandler <string>(httpRequestFactory, this); var preMarshallHandler = new CallbackHandler(); preMarshallHandler.OnPreInvoke = this.ProcessPreRequestHandlers; var postMarshallHandler = new CallbackHandler(); postMarshallHandler.OnPreInvoke = this.ProcessRequestHandlers; var postUnmarshallHandler = new CallbackHandler(); postUnmarshallHandler.OnPostInvoke = this.ProcessResponseHandlers; var errorCallbackHandler = new ErrorCallbackHandler(); errorCallbackHandler.OnError = this.ProcessExceptionHandlers; // Build default runtime pipeline. this.RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler> { httpHandler, new Unmarshaller(this.SupportResponseLogging), new ErrorHandler(this.Logger), postUnmarshallHandler, new Signer(), new CredentialsRetriever(this.Credentials), new RetryHandler(new DefaultRetryPolicy(this.Config.MaxErrorRetry)), postMarshallHandler, new EndpointResolver(), new Marshaller(), preMarshallHandler, errorCallbackHandler, new MetricsHandler(), new ThreadPoolExecutionHandler(10) //remove the hardcoded to unity config }, this.Logger ); CustomizeRuntimePipeline(this.RuntimePipeline); }
private void BuildRuntimePipeline() { HttpHandler <string> httpHandler = null; httpHandler = ((AWSConfigs.HttpClient != 0) ? new HttpHandler <string>(new UnityWebRequestFactory(), this) : new HttpHandler <string>(new UnityWwwRequestFactory(), this)); CallbackHandler callbackHandler = new CallbackHandler(); callbackHandler.OnPreInvoke = ProcessPreRequestHandlers; CallbackHandler callbackHandler2 = new CallbackHandler(); callbackHandler2.OnPreInvoke = ProcessRequestHandlers; CallbackHandler callbackHandler3 = new CallbackHandler(); callbackHandler3.OnPostInvoke = ProcessResponseHandlers; ErrorCallbackHandler errorCallbackHandler = new ErrorCallbackHandler(); errorCallbackHandler.OnError = ProcessExceptionHandlers; RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler> { httpHandler, new Unmarshaller(SupportResponseLogging), new ErrorHandler(_logger), callbackHandler3, new Signer(), new CredentialsRetriever(Credentials), new RetryHandler(new DefaultRetryPolicy(Config)), callbackHandler2, new EndpointResolver(), new Marshaller(), callbackHandler, errorCallbackHandler, new MetricsHandler(), new ThreadPoolExecutionHandler(10) }, _logger); CustomizeRuntimePipeline(RuntimePipeline); }
private void BuildRuntimePipeline() { #if BCL var httpRequestFactory = new HttpWebRequestFactory(new AmazonSecurityProtocolManager()); var httpHandler = new HttpHandler <Stream>(httpRequestFactory, this); #else var httpRequestFactory = new HttpRequestMessageFactory(this.Config); var httpHandler = new HttpHandler <System.Net.Http.HttpContent>(httpRequestFactory, this); #endif var preMarshallHandler = new CallbackHandler(); preMarshallHandler.OnPreInvoke = this.ProcessPreRequestHandlers; var postMarshallHandler = new CallbackHandler(); postMarshallHandler.OnPreInvoke = this.ProcessRequestHandlers; var postUnmarshallHandler = new CallbackHandler(); postUnmarshallHandler.OnPostInvoke = this.ProcessResponseHandlers; var errorCallbackHandler = new ErrorCallbackHandler(); errorCallbackHandler.OnError = this.ProcessExceptionHandlers; //Determine which retry policy to use based on the retry mode RetryPolicy retryPolicy; switch (this.Config.RetryMode) { case RequestRetryMode.Adaptive: retryPolicy = new AdaptiveRetryPolicy(this.Config); break; case RequestRetryMode.Standard: retryPolicy = new StandardRetryPolicy(this.Config); break; case RequestRetryMode.Legacy: retryPolicy = new DefaultRetryPolicy(this.Config); break; default: throw new InvalidOperationException("Unknown retry mode"); } // Build default runtime pipeline. this.RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler> { httpHandler, new Unmarshaller(this.SupportResponseLogging), new ErrorHandler(_logger), postUnmarshallHandler, new Signer(), //EndpointDiscoveryResolver must come after CredentialsRetriever, RetryHander, and EndpointResolver as it depends on //credentials, retrying of requests for 421 web exceptions, and the current set regional endpoint. new EndpointDiscoveryHandler(), new CredentialsRetriever(this.Credentials), new RetryHandler(retryPolicy), postMarshallHandler, new EndpointResolver(), new Marshaller(), preMarshallHandler, errorCallbackHandler, new MetricsHandler() }, _logger ); if (DeterminedCSMConfiguration.Instance.CSMConfiguration.Enabled && !string.IsNullOrEmpty(ServiceMetadata.ServiceId)) { this.RuntimePipeline.AddHandlerBefore <ErrorHandler>(new CSMCallAttemptHandler()); this.RuntimePipeline.AddHandlerBefore <MetricsHandler>(new CSMCallEventHandler()); } CustomizeRuntimePipeline(this.RuntimePipeline); // Apply global pipeline customizations RuntimePipelineCustomizerRegistry.Instance.ApplyCustomizations(this.GetType(), this.RuntimePipeline); }
private void BuildRuntimePipeline() { #if BCL || BCL45 var httpRequestFactory = new HttpWebRequestFactory(new AmazonSecurityProtocolManager()); var httpHandler = new HttpHandler <Stream>(httpRequestFactory, this); #elif UNITY IHttpRequestFactory <string> httpRequestFactory = null; HttpHandler <string> httpHandler = null; if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW) { httpRequestFactory = new UnityWwwRequestFactory(); httpHandler = new HttpHandler <string>(httpRequestFactory, this); } else { httpRequestFactory = new UnityWebRequestFactory(); httpHandler = new HttpHandler <string>(httpRequestFactory, this); } #else var httpRequestFactory = new HttpRequestMessageFactory(this.Config); var httpHandler = new HttpHandler <System.Net.Http.HttpContent>(httpRequestFactory, this); #endif var preMarshallHandler = new CallbackHandler(); preMarshallHandler.OnPreInvoke = this.ProcessPreRequestHandlers; var postMarshallHandler = new CallbackHandler(); postMarshallHandler.OnPreInvoke = this.ProcessRequestHandlers; var postUnmarshallHandler = new CallbackHandler(); postUnmarshallHandler.OnPostInvoke = this.ProcessResponseHandlers; var errorCallbackHandler = new ErrorCallbackHandler(); errorCallbackHandler.OnError = this.ProcessExceptionHandlers; // Build default runtime pipeline. this.RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler> { httpHandler, new Unmarshaller(this.SupportResponseLogging), new ErrorHandler(_logger), postUnmarshallHandler, new Signer(), new CredentialsRetriever(this.Credentials), new RetryHandler(new DefaultRetryPolicy(this.Config)), postMarshallHandler, new EndpointResolver(), new Marshaller(), preMarshallHandler, errorCallbackHandler, new MetricsHandler() #if UNITY , new ThreadPoolExecutionHandler(10) //remove the hardcoded to unity config #endif }, _logger ); #if BCL || CORECLR if (DeterminedCSMConfiguration.Instance.CSMConfiguration.Enabled && !string.IsNullOrEmpty(ServiceMetadata.ServiceId)) { this.RuntimePipeline.AddHandlerBefore <ErrorHandler>(new CSMCallAttemptHandler()); this.RuntimePipeline.AddHandlerBefore <MetricsHandler>(new CSMCallEventHandler()); } #endif CustomizeRuntimePipeline(this.RuntimePipeline); // Apply global pipeline customizations RuntimePipelineCustomizerRegistry.Instance.ApplyCustomizations(this.GetType(), this.RuntimePipeline); }
internal static void RunErrorCallbacks(string namesection, string msg) => ErrorCallbackHandler?.Invoke(namesection, msg);
/// <summary> /// Exposes optional callback functions to be executed after an async operation is completed. /// Save and Refresh functions /// </summary> /// <param name="SuccessCallbackHandler">A function to call when the operation succeeds</param> /// <param name="ErrorCallbackHandler">A function to call when the operation fails</param> public void Then(ParameterlessFunctionHandler SuccessCallbackHandler, ErrorCallbackHandler ErrorCallbackHandler) { }
/// <summary> /// CRM2013 Only: Exposes optional callback functions to be executed after an async operation is completed. /// Save and Refresh functions /// </summary> /// <param name="SuccessCallbackHandler">A function to call when the operation succeeds</param> /// <param name="ErrorCallbackHandler">A function to call when the operation fails</param> public void Then(ParameterlessFunctionHandler SuccessCallbackHandler, ErrorCallbackHandler ErrorCallbackHandler) { }