mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 19:14:26 +00:00
Don't use SystemException but a PropertyListException to indicate something went wrong.
This commit is contained in:
@@ -373,7 +373,7 @@ namespace Claunia.PropertyList
|
|||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
throw new SystemException("The given object of class " + o.GetType() + " could not be serialized and stored in a NSData object.");
|
throw new PropertyListException("The given object of class " + o.GetType() + " could not be serialized and stored in a NSData object.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace Claunia.PropertyList
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new SystemException("Could not encode the NSString into UTF-8: " + ex.Message);
|
throw new PropertyListException("Could not encode the NSString into UTF-8: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
77
plist-cil/PropertyListException.cs
Normal file
77
plist-cil/PropertyListException.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
// plist-cil - An open source library to parse and generate property lists for .NET
|
||||||
|
// Copyright (C) 2015 Natalia Portillo
|
||||||
|
// Copyright (C) 2016 Quamotion
|
||||||
|
//
|
||||||
|
// This code is based on:
|
||||||
|
// plist - An open source library to parse and generate property lists
|
||||||
|
// Copyright (C) 2014 Daniel Dreibrodt
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
using System;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace Claunia.PropertyList
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The exception that is thrown when an property list file could not be processed correctly.
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
public class PropertyListException : Exception
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PropertyListException"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public PropertyListException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PropertyListException"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">
|
||||||
|
/// The error message that explains the reason for the exception.
|
||||||
|
/// </param>
|
||||||
|
public PropertyListException(string message)
|
||||||
|
: base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PropertyListException"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">
|
||||||
|
/// The error message that explains the reason for the exception.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="inner">
|
||||||
|
/// The exception that is the cause of the current exception, or <see langword="null"/>
|
||||||
|
/// if no inner exception is specified.
|
||||||
|
/// </param>
|
||||||
|
public PropertyListException(string message, Exception inner)
|
||||||
|
: base(message, inner)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !NETCORE
|
||||||
|
protected PropertyListException(SerializationInfo info, StreamingContext context)
|
||||||
|
: base(info, context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ namespace Claunia.PropertyList
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// @author Daniel Dreibrodt
|
/// @author Daniel Dreibrodt
|
||||||
/// @author Natalia Portillo
|
/// @author Natalia Portillo
|
||||||
public class PropertyListFormatException : Exception
|
public class PropertyListFormatException : PropertyListException
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new exception with the given message.
|
/// Creates a new exception with the given message.
|
||||||
|
|||||||
Reference in New Issue
Block a user