/* Copyright 2010-2018 Jesse McGrew * * This file is part of ZILF. * * ZILF is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ZILF is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ZILF. If not, see . */ using System; using System.Runtime.Serialization; namespace Zapf.Parsing.Diagnostics { [Serializable] public abstract class AssemblerError : Exception { protected AssemblerError(ISourceLine? node, string message) : base(message) { Node = node; } protected AssemblerError(SerializationInfo info, StreamingContext context) : base(info, context) { Node = (ISourceLine)info.GetValue("node", typeof(ISourceLine)); } public ISourceLine? Node { get; } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); if (Node != null) { info.AddValue("node", Node); } } } }