本文整理汇总了C#中ErrorHandler类的典型用法代码示例。如果您正苦于以下问题:C# ErrorHandler类的具体用法?C# ErrorHandler怎么用?C# ErrorHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorHandler类属于命名空间,在下文中一共展示了ErrorHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ErrorHandler
Expression IContractDeserializer.ParseContract (MethodContract mc, string text, ErrorNodeList errs)
{
Expression expression = null;
currentMethodContract = mc;
currentMethod = null;
currentType = null;
if (mc != null){
currentMethod = mc.DeclaringMethod;
currentType = currentMethod.DeclaringType;
}
try{
Parser.ParseContract(this.assembly, text, out expression);
}catch (Exception e){
ErrorNodeList eList = errs != null ? errs : this.ErrorList;
if (eList != null){
#if OLDERRORS
ErrorHandler eh = new ErrorHandler(eList);
eh.HandleError(mc,System.Compiler.Error.GenericError,"Deserializer error: " + e.Message);
#else
this.assembly.MetadataImportErrors.Add(e);
#endif
}
throw e;
}
return expression;
}
示例2: SocketClient
/// <summary>
/// Constructor for client support
/// </summary>
/// <param name="sizeOfRawBuffer"> The size of the raw buffer </param>
/// <param name="userArg"> A Reference to the Users arguments </param>
/// <param name="messageHandler"> Reference to the user defined message handler method </param>
/// <param name="closeHandler"> Reference to the user defined close handler method </param>
/// <param name="errorHandler"> Reference to the user defined error handler method </param>
public SocketClient(int sizeOfRawBuffer, object userArg,
MessageHandler messageHandler, CloseHandler closeHandler,
ErrorHandler errorHandler, ConnectHandler connectHandler)
{
// Create the raw buffer
this.SizeOfRawBuffer = sizeOfRawBuffer;
this.RawBuffer = new Byte[this.SizeOfRawBuffer];
// Save the user argument
this.userArg = userArg;
// Set the handler methods
this.messageHandler = messageHandler;
this.closeHandler = closeHandler;
this.errorHandler = errorHandler;
this.connectHandler = connectHandler;
// Set the async socket method handlers
this.callbackReadMethod = new AsyncCallback(ReceiveComplete);
this.callbackWriteMethod = new AsyncCallback(SendComplete);
this.callbackWriteHeadMethod = new AsyncCallback(SendHead);
this.m_Connected = true;
// Init the dispose flag
this.disposed = false;
}
示例3: ApplyDispatchBehavior
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
var eh=new ErrorHandler();
foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers)
((ChannelDispatcher)cdb).ErrorHandlers.Insert(0, eh);
}
示例4: DoSemanticChecks
public override void DoSemanticChecks(ErrorHandler errs, Scope currentScope)
{
foreach (AstNode astNode in _content)
{
astNode.DoSemanticChecks(errs, currentScope);
}
}
示例5: rankingTops
public static void rankingTops(String token, String list_id, int count, int start_row, String time_type, String relation_type, YebobHandler handler, ErrorHandler onError)
{
String url = String.Format("{0}/ranking/tops?list_id={1}&count={2}&start_row={3}&time_type={4}&relation_type={5}",
URL_PREFIX, list_id, count, start_row, time_type, relation_type);
getWithToken(token, url, handler, onError);
}
示例6: AwardAchievement
/// <summary>
/// Awards an achievement.
/// </summary>
/// <param name="achievementName">The name of the achievement to award.</param>
/// <param name="success">Callback triggers on successful award.</param>
/// <param name="error">Callback triggers on error.</param>
public static Coroutine AwardAchievement(string achievementName, SuccessHandler success, ErrorHandler error)
{
drWWW www = new drWWW(drAPI.awardAchievement);
www.AddField("name", achievementName);
www.OnSuccess += delegate {
if (!(bool)www.result) { // This should never occur, but the check is here just in case
drDebug.LogWarning("Did not award achievement \"" + achievementName + "\"");
return;
}
if (!_awardedAchievements.Contains(achievementName)) {
_awardedAchievements.Add(achievementName);
}
drClient.RefreshCanvasComponent(drClient.CanvasComponent.Achievements);
drDebug.Log("Awarded achievement " + achievementName);
}; www.OnSuccess += success;
www.OnError += delegate (string errorMessage) {
drDebug.LogError("Error awarding achievement \"" + achievementName + "\": " + errorMessage);
}; www.OnError += error;
return www.Fetch();
}
示例7: ApplyDispatchBehavior
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
{
IErrorHandler handler = new ErrorHandler();
foreach (ChannelDispatcher chDisp in serviceHostBase.ChannelDispatchers)
{
if (chDisp.BindingName.Contains("WebHttpBinding"))
{
chDisp.ErrorHandlers.Add(handler);
foreach (EndpointDispatcher epDisp in chDisp.Endpoints)
{
epDisp.DispatchRuntime.MessageInspectors.Add(new Authenticator());
}
}
}
foreach (ServiceEndpoint endpoint in serviceDescription.Endpoints)
{
if (endpoint.Binding.GetType() == typeof(WebHttpBinding))
{
foreach (OperationDescription operation in endpoint.Contract.Operations)
{
operation.Behaviors.Add(new CustomMessageFormatter.Behavior());
}
}
}
}
示例8: ParseSource
public override Microsoft.VisualStudio.Package.AuthoringScope ParseSource(ParseRequest req)
{
Babel.Source source = (Babel.Source)this.GetSource(req.FileName);
bool yyparseResult = false;
// req.DirtySpan seems to be set even though no changes have occurred
// source.IsDirty also behaves strangely
// might be possible to use source.ChangeCount to sync instead
if (req.DirtySpan.iStartIndex != req.DirtySpan.iEndIndex
|| req.DirtySpan.iStartLine != req.DirtySpan.iEndLine) {
ErrorHandler handler = new ErrorHandler();
Scanner scanner = new Scanner(); // string interface
Parser parser = new Parser(); // use noarg constructor
parser.scanner = scanner;
scanner.Handler = handler;
parser.SetHandler(handler);
scanner.SetSource(req.Text, 0);
parser.MBWInit(req);
yyparseResult = parser.Parse();
// store the parse results
// source.ParseResult = aast;
source.ParseResult = null;
source.Braces = parser.Braces;
// for the time being, just pull errors back from the error handler
if (handler.ErrNum > 0) {
foreach (Babel.Parser.Error error in handler.SortedErrorList()) {
TextSpan span = new TextSpan();
span.iStartLine = span.iEndLine = error.line - 1;
span.iStartIndex = error.column;
span.iEndIndex = error.column + error.length;
req.Sink.AddError(req.FileName, error.message, span, Severity.Error);
}
}
}
switch (req.Reason) {
case ParseReason.Check:
case ParseReason.HighlightBraces:
case ParseReason.MatchBraces:
case ParseReason.MemberSelectAndHighlightBraces:
// send matches to sink
// this should (probably?) be filtered on req.Line / col
if (source.Braces != null) {
foreach (TextSpan[] brace in source.Braces) {
if (brace.Length == 2)
req.Sink.MatchPair(brace[0], brace[1], 1);
else if (brace.Length >= 3)
req.Sink.MatchTriple(brace[0], brace[1], brace[2], 1);
}
}
break;
default:
break;
}
return new AuthoringScope(req.Text);
}
示例9: Parser
public Parser(Scanner scanner, ErrorHandler errors)
{
_scanner = scanner;
_scanner.GetToken();
_errors = errors;
}
示例10: LoadData
/// <summary>
/// Loads data.
/// </summary>
/// <param name="success">Callback triggers on successful data load.</param>
/// <param name="error">Callback triggers on error.</param>
public static Coroutine LoadData(SuccessHandler success, ErrorHandler error)
{
drWWW www = new drWWW(drAPI.loadData);
www.OnSuccess += delegate {
Hashtable result = www.result as Hashtable;
if (result["data"] == null) {
drDebug.LogWarning("No data exists in the data store to load");
return;
}
if (data == null) {
data = new Dictionary<string, object>();
}
StoreReturnData(result["data"] as Hashtable);
drDebug.Log("Loaded data");
}; www.OnSuccess += success;
www.OnError += delegate (string errorMessage) {
drDebug.LogError("Error loading data: " + errorMessage);
}; www.OnError += error;
return www.Fetch();
}
示例11: StartTry
public static Thread StartTry(MethodInvoker code, ErrorHandler on_error = null, MethodInvoker on_finally = null, bool background = true)
{
Thread t = new Thread(
() => {
try
{
code.Invoke();
}
catch (ThreadAbortException e)
{
Thread.ResetAbort();
}
catch (Exception e)
{
if (on_error != null)
on_error.Invoke(e);
else
Message.Error(e);
}
finally
{
on_finally?.Invoke();
}
}
);
t.IsBackground = background;
t.Start();
return t;
}
示例12: Awake
new void Awake()
{
base.Awake();
if(smartFox.IsConnected)
{
CharacterList = new CharacterListHandler();
CharacterSelected = new CharacterSelectedHandler();
errorHandler = new ErrorHandler();
// Register callback delegate
smartFox.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
smartFox.AddEventListener(SFSEvent.LOGOUT, OnLogout);
smartFox.AddLogListener(LogLevel.DEBUG, OnDebugMessage);
// Personal message handlers
handlers.Add("characterlist", CharacterList);
handlers.Add("characterSelected", CharacterSelected);
handlers.Add("error", errorHandler);
CharacterList.afterMessageRecieved += AfterCharacterList;
CharacterSelected.afterMessageRecieved += AfterCharacterSelected;
// We are ready to get the character list
new GetCharactersMessage(smartFox, false).Send();
}
else
{
Application.LoadLevel("Lobby");
}
}
示例13: PublishFolderPicker
public PublishFolderPicker(string destinationName, ErrorHandler errorCallback, string rootPath)
{
// This call is required by the Windows Form Designer.
InitializeComponent();
destinationTree.RightToLeftLayout = true;
this.buttonOK.Text = Res.Get(StringId.OKButtonText);
this.buttonCancel.Text = Res.Get(StringId.CancelButton);
this.label1.Text = Res.Get(StringId.PublishFolderPickerCaption);
this.buttonNewFolder.ButtonText = Res.Get(StringId.NewFolder);
this.buttonNewFolder.AccessibleName = Res.Get(StringId.NewFolder);
this.buttonNewFolder.ToolTip = Res.Get(StringId.NewFolderTooltip);
this.Text = Res.Get(StringId.PublishFolderPickerTitle);
//set the error handler.
errorHandler = errorCallback;
//Root Node
RootNode = new TreeNode();
// configure tree
RootNode.Text = destinationName;
RootNode.Tag = rootPath;
destinationTree.Nodes.Add(RootNode);
destinationTree.SelectedNode = RootNode;
destinationTree.SelectedNode.ImageIndex = 0;
}
示例14: this
public XmlParserInput
(TextReader reader,
XmlNameTable nameTable,
ErrorHandler error)
: this(reader, nameTable, null, error)
{
}
示例15: ApplyDispatchBehavior
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
{
ErrorHandler handler = new ErrorHandler();
foreach (ChannelDispatcher dispatcher in serviceHostBase.ChannelDispatchers)
{
dispatcher.ErrorHandlers.Add(handler);
}
}