| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using CefSharp;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace UAS_Web.tool
- {
- class ExceptionTestBoundObject
- {
- [DebuggerStepThrough]
- private double DivisionByZero(int zero)
- {
- return 10 / zero;
- }
- [DebuggerStepThrough]
- public double TriggerNestedExceptions()
- {
- try
- {
- try
- {
- return DivisionByZero(0);
- }
- catch (Exception innerException)
- {
- throw new InvalidOperationException("Nested Exception Invalid", innerException);
- }
- }
- catch (Exception e)
- {
- throw new OperationCanceledException("Nested Exception Canceled", e);
- }
- }
- [DebuggerStepThrough]
- public int TriggerParameterException(int parameter)
- {
- return parameter;
- }
- public void TestCallbackException(IJavascriptCallback errorCallback, IJavascriptCallback errorCallbackResult)
- {
- const int taskDelay = 500;
- //Task.Run(async () =>
- //{
- // await TaskEx.Delay(taskDelay);
- // using (errorCallback)
- // {
- // JavascriptResponse result = await errorCallback.ExecuteAsync("This callback from C# was delayed " + taskDelay + "ms");
- // string resultMessage;
- // if (result.Success)
- // {
- // resultMessage = "Fatal: No Exception thrown in error callback";
- // }
- // else
- // {
- // resultMessage = "Exception Thrown: " + result.Message;
- // }
- // await errorCallbackResult.ExecuteAsync(resultMessage);
- // }
- //});
- }
- }
- }
|