1
1
namespace Meteor
2
2
{
3
+ /// <summary>
4
+ /// A Meteor error.
5
+ /// </summary>
3
6
[ System . Serializable ]
4
7
public class Error
5
8
{
9
+ /// <summary>
10
+ /// The reason for the error. Corresponds to the second argument of your <code>new Meteor.Error</code> call in your Meteor code.
11
+ /// </summary>
6
12
public string reason ;
13
+ /// <summary>
14
+ /// The error code. Corresponds to the first argument of your <code>new Meteor.Error</code> call in your Meteor code.
15
+ /// </summary>
7
16
public int error ;
17
+ /// <summary>
18
+ /// The error details. Corresponds to the third and last argument of your <code>new Meteor.Error</code> call in your Meteor code.
19
+ /// </summary>
8
20
public string details ;
9
21
10
22
public Error ( )
@@ -18,11 +30,22 @@ bool IsNull ()
18
30
&& string . IsNullOrEmpty ( details ) ;
19
31
}
20
32
33
+ /// <summary>
34
+ /// Serves as a hash function for a <see cref="Meteor.Error"/> object. This is defined as the error code in order to facilitate better comparisons.
35
+ /// </summary>
36
+ /// <returns>A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a hash table.</returns>
21
37
public override int GetHashCode ( )
22
38
{
23
- return base . GetHashCode ( ) ;
39
+ return error ;
24
40
}
25
41
42
+ /// <summary>
43
+ /// Determines whether the specified <see cref="System.Object"/> is equal to the current <see cref="Meteor.Error"/>. If both objects are errors,
44
+ /// their reason and error codes will be compared instead of the instances.
45
+ /// </summary>
46
+ /// <param name="obj">The <see cref="System.Object"/> to compare with the current <see cref="Meteor.Error"/>.</param>
47
+ /// <returns><c>true</c> if the specified <see cref="System.Object"/> is equal to the current <see cref="Meteor.Error"/>;
48
+ /// otherwise, <c>false</c>.</returns>
26
49
public override bool Equals ( object obj )
27
50
{
28
51
if ( obj == null ) {
@@ -35,6 +58,9 @@ public override bool Equals (object obj)
35
58
&& error == other . error ;
36
59
}
37
60
61
+ /// <summary>
62
+ /// Compares two error objects to see if their reasons and error codes are equal.
63
+ /// </summary>
38
64
public static bool operator == ( Error a , Error b )
39
65
{
40
66
var isNullA = ( object ) a == null || a . IsNull ( ) ;
@@ -45,6 +71,9 @@ public override bool Equals (object obj)
45
71
return nullComparison || ( isNullA ? b . Equals ( a ) : a . Equals ( b ) ) ;
46
72
}
47
73
74
+ /// <summary>
75
+ /// Compares two error objects to see if their reasons and error codes are not equal.
76
+ /// </summary>
48
77
public static bool operator != ( Error a , Error b )
49
78
{
50
79
return ! ( a == b ) ;
0 commit comments