Skip to content

Commit f6084d8

Browse files
committed
Release 7.2
1 parent f591ee9 commit f6084d8

File tree

291 files changed

+7510
-5215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

291 files changed

+7510
-5215
lines changed

-/Get.cs

-62
This file was deleted.

-/GetSet.cs

-31
This file was deleted.

-/Handle.cs

-49
This file was deleted.

-/Try.cs

-37
This file was deleted.

-/While.cs

-14
This file was deleted.

Analytics/Error.cs

+36-58
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,48 @@
1-
using System;
1+
using Imagin.Core.Linq;
2+
using System;
23
using System.Xml.Serialization;
34

4-
namespace Imagin.Core.Analytics
5-
{
6-
/// <summary>
7-
/// Represents an unsuccessful <see cref="Result"/> that encapsulates an <see cref="Exception"/>.
8-
/// </summary>
9-
[Serializable]
10-
public class Error : Result
11-
{
12-
string fullName;
13-
[XmlAttribute]
14-
public string FullName
15-
{
16-
get => fullName;
17-
set => this.Change(ref fullName, value);
18-
}
19-
20-
Error inner = null;
21-
[XmlElement]
22-
public Error Inner
23-
{
24-
get => inner;
25-
set => this.Change(ref inner, value);
26-
}
5+
namespace Imagin.Core.Analytics;
276

28-
string name;
29-
[XmlAttribute]
30-
public string Name
31-
{
32-
get => name;
33-
set => this.Change(ref name, value);
34-
}
7+
/// <summary>Represents an unsuccessful <see cref="Result"/> that encapsulates an <see cref="Exception"/>.</summary>
8+
[Serializable]
9+
public class Error : Result
10+
{
11+
[XmlAttribute]
12+
public string FullName { get => Get(""); set => Set(value); }
3513

36-
string stackTrace;
37-
[XmlElement]
38-
public string StackTrace
39-
{
40-
get => stackTrace;
41-
set => this.Change(ref stackTrace, value);
42-
}
14+
[XmlElement]
15+
public Error Inner { get => Get<Error>(); set => Set(value); }
4316

44-
[XmlIgnore]
45-
public override ResultTypes Type => ResultTypes.Error;
17+
[XmlAttribute]
18+
public string Name { get => Get(""); set => Set(value); }
4619

47-
public Error() : this(new Exception()) { }
20+
[XmlElement]
21+
public string StackTrace { get => Get(""); set => Set(value); }
4822

49-
public Error(object message) : this(new Exception($"{message}")) { }
23+
[XmlIgnore]
24+
public override ResultTypes Type => ResultTypes.Error;
5025

51-
public Error(Exception exception) : base(exception.Message)
52-
{
53-
exception = exception ?? new Exception();
26+
public Error() : this(new Exception()) { }
5427

55-
Inner
56-
= exception.InnerException != null
57-
? new Error(exception.InnerException)
58-
: null;
28+
public Error(object message) : this(new Exception($"{message}")) { }
5929

60-
Text
61-
= exception.Message;
62-
Name
63-
= exception.GetType().Name;
64-
FullName
65-
= exception.GetType().FullName;
66-
StackTrace
67-
= exception.StackTrace;
68-
}
30+
public Error(Exception exception) : base(exception.Message)
31+
{
32+
exception = exception ?? new Exception();
33+
34+
Inner
35+
= exception.InnerException != null
36+
? new Error(exception.InnerException)
37+
: null;
38+
39+
Text
40+
= exception.Message;
41+
Name
42+
= exception.GetType().GetAttribute<NameAttribute>()?.Name ?? exception.GetType().Name;
43+
FullName
44+
= exception.GetType().FullName;
45+
StackTrace
46+
= exception.StackTrace;
6947
}
7048
}

Analytics/ErrorEvent.cs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using Imagin.Core.Input;
22

3-
namespace Imagin.Core.Analytics
4-
{
5-
public delegate void ErrorEventHandler(object sender, ErrorEventArgs e);
3+
namespace Imagin.Core.Analytics;
4+
5+
public delegate void ErrorEventHandler(object sender, ErrorEventArgs e);
66

7-
public class ErrorEventArgs : EventArgs<Error>
8-
{
9-
public ErrorEventArgs(Error input) : base(input) { }
10-
}
7+
public class ErrorEventArgs : EventArgs<Error>
8+
{
9+
public ErrorEventArgs(Error input) : base(input) { }
1110
}

Analytics/Errors.cs

+31
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,48 @@ public class ChildNotFoundException<Child, Parent> : Exception
77
public ChildNotFoundException() : base($"'{typeof(Parent).FullName}' must have logical or visual child of type '{typeof(Child).FullName}'.") { }
88
}
99

10+
public class DeserializationFailedException : Exception
11+
{
12+
public DeserializationFailedException(Type type, Exception inner = null) : base($"'{type.FullName}' failed to deserialize.", inner) { }
13+
}
14+
1015
public class ExternalChangeException<Object> : Exception
1116
{
1217
public ExternalChangeException(string propertyName) : base($"External changes to '{typeof(Object).FullName}.{propertyName}' are not allowed.") { }
1318
}
1419

20+
public class FileNotSupported : Exception
21+
{
22+
public FileNotSupported(string filePath) : base($"The file '{filePath}' is not supported.") { }
23+
}
24+
1525
public class InvalidAncestor<Target> : Exception
1626
{
1727
public InvalidAncestor() : base($"'{typeof(Target).FullName}' must be an ancestor.") { }
1828
}
1929

30+
public class InvalidFileException : Exception
31+
{
32+
public InvalidFileException(string filePath) : base($"The file '{filePath}' is invalid or corrupt.") { }
33+
}
34+
2035
public class ParentNotFoundException<Child, Parent> : Exception
2136
{
2237
public ParentNotFoundException() : base($"'{typeof(Child).FullName}' must have logical or visual parent of type '{typeof(Parent).FullName}'.") { }
38+
}
39+
40+
public class NotCloneableException<T> : Exception
41+
{
42+
public NotCloneableException() : base($"'{typeof(T).FullName}' is not cloneable.") { }
43+
}
44+
45+
public class SerializationFailedException : Exception
46+
{
47+
public SerializationFailedException(Type type, Exception inner = null) : base($"'{type.FullName}' failed to serialize.", inner) { }
48+
}
49+
50+
[Name("Wrong password")]
51+
public class WrongPasswordException : Exception
52+
{
53+
public WrongPasswordException() : base("The password entered is incorrect.") { }
2354
}

0 commit comments

Comments
 (0)