Skip to content

Commit b9568ad

Browse files
Rename ErrorType exception properties to avoid hiding inherited member
1 parent 14e2efd commit b9568ad

File tree

8 files changed

+54
-33
lines changed

8 files changed

+54
-33
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
3+
{
4+
"services": [
5+
{
6+
"serviceName": "Account",
7+
"type": "patch",
8+
"changeLogMessages": [
9+
"Rename internal exception property to avoid hiding inherited AmazonServiceException member."
10+
]
11+
}
12+
]
13+
}

generator/ServiceClientGeneratorLib/Member.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ public string BasePropertyName
237237
}
238238
}
239239

240+
var propertyNameOverride = GetPropertyNameOverride();
241+
if (!string.IsNullOrEmpty(propertyNameOverride))
242+
return propertyNameOverride;
243+
244+
240245
return _name.ToUpperFirstCharacter();
241246
}
242247
}
@@ -482,6 +487,22 @@ public string DetermineType()
482487
return DetermineType(this.data, false);
483488
}
484489

490+
/// <summary>
491+
/// Retrieves a property name override for specific member names that require special handling
492+
/// during code generation to avoid naming conflicts or improve API consistency.
493+
/// </summary>
494+
/// <returns>
495+
/// A string containing the overridden property name if a special case applies,
496+
/// or null if the default property name should be used.
497+
/// </returns>
498+
private string GetPropertyNameOverride()
499+
{
500+
if (OwningShape.IsException && _name.ToUpperFirstCharacter() == "ErrorType")
501+
return "RequestErrorType";
502+
503+
return null;
504+
}
505+
485506
/// <summary>
486507
/// Determines the type of the member based on customizations, if it isn't custom then it pulls
487508
/// from the full json model to get the shape of this member

generator/ServiceModels/account/account.customizations.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

sdk/src/Services/Account/Generated/Model/AccessDeniedException.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Amazon.Account.Model
3838
#endif
3939
public partial class AccessDeniedException : AmazonAccountException
4040
{
41-
private string _requestErrorType;
41+
private string _errorType;
4242

4343
/// <summary>
4444
/// Constructs a new AccessDeniedException with the specified error
@@ -128,14 +128,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
128128
/// </summary>
129129
public string RequestErrorType
130130
{
131-
get { return this._requestErrorType; }
132-
set { this._requestErrorType = value; }
131+
get { return this._errorType; }
132+
set { this._errorType = value; }
133133
}
134134

135135
// Check to see if RequestErrorType property is set
136136
internal bool IsSetRequestErrorType()
137137
{
138-
return this._requestErrorType != null;
138+
return this._errorType != null;
139139
}
140140

141141
}

sdk/src/Services/Account/Generated/Model/ConflictException.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace Amazon.Account.Model
4040
#endif
4141
public partial class ConflictException : AmazonAccountException
4242
{
43-
private string _requestErrorType;
43+
private string _errorType;
4444

4545
/// <summary>
4646
/// Constructs a new ConflictException with the specified error
@@ -130,14 +130,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
130130
/// </summary>
131131
public string RequestErrorType
132132
{
133-
get { return this._requestErrorType; }
134-
set { this._requestErrorType = value; }
133+
get { return this._errorType; }
134+
set { this._errorType = value; }
135135
}
136136

137137
// Check to see if RequestErrorType property is set
138138
internal bool IsSetRequestErrorType()
139139
{
140-
return this._requestErrorType != null;
140+
return this._errorType != null;
141141
}
142142

143143
}

sdk/src/Services/Account/Generated/Model/InternalServerException.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Amazon.Account.Model
3838
#endif
3939
public partial class InternalServerException : AmazonAccountException
4040
{
41-
private string _requestErrorType;
41+
private string _errorType;
4242

4343
private RetryableDetails _retryableDetails = new RetryableDetails(false);
4444

@@ -130,14 +130,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
130130
/// </summary>
131131
public string RequestErrorType
132132
{
133-
get { return this._requestErrorType; }
134-
set { this._requestErrorType = value; }
133+
get { return this._errorType; }
134+
set { this._errorType = value; }
135135
}
136136

137137
// Check to see if RequestErrorType property is set
138138
internal bool IsSetRequestErrorType()
139139
{
140-
return this._requestErrorType != null;
140+
return this._errorType != null;
141141
}
142142

143143
/// <summary>

sdk/src/Services/Account/Generated/Model/ResourceNotFoundException.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace Amazon.Account.Model
3737
#endif
3838
public partial class ResourceNotFoundException : AmazonAccountException
3939
{
40-
private string _requestErrorType;
40+
private string _errorType;
4141

4242
/// <summary>
4343
/// Constructs a new ResourceNotFoundException with the specified error
@@ -127,14 +127,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
127127
/// </summary>
128128
public string RequestErrorType
129129
{
130-
get { return this._requestErrorType; }
131-
set { this._requestErrorType = value; }
130+
get { return this._errorType; }
131+
set { this._errorType = value; }
132132
}
133133

134134
// Check to see if RequestErrorType property is set
135135
internal bool IsSetRequestErrorType()
136136
{
137-
return this._requestErrorType != null;
137+
return this._errorType != null;
138138
}
139139

140140
}

sdk/src/Services/Account/Generated/Model/TooManyRequestsException.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Amazon.Account.Model
3838
#endif
3939
public partial class TooManyRequestsException : AmazonAccountException
4040
{
41-
private string _requestErrorType;
41+
private string _errorType;
4242

4343
private RetryableDetails _retryableDetails = new RetryableDetails(true);
4444

@@ -130,14 +130,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
130130
/// </summary>
131131
public string RequestErrorType
132132
{
133-
get { return this._requestErrorType; }
134-
set { this._requestErrorType = value; }
133+
get { return this._errorType; }
134+
set { this._errorType = value; }
135135
}
136136

137137
// Check to see if RequestErrorType property is set
138138
internal bool IsSetRequestErrorType()
139139
{
140-
return this._requestErrorType != null;
140+
return this._errorType != null;
141141
}
142142

143143
/// <summary>

0 commit comments

Comments
 (0)