Skip to content

Commit d6381fa

Browse files
Rename ErrorType exception properties to avoid hiding inherited member
1 parent 1142885 commit d6381fa

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
@@ -253,6 +253,11 @@ public string BasePropertyName
253253
}
254254
}
255255

256+
var propertyNameOverride = GetPropertyNameOverride();
257+
if (!string.IsNullOrEmpty(propertyNameOverride))
258+
return propertyNameOverride;
259+
260+
256261
return _name.ToUpperFirstCharacter();
257262
}
258263
}
@@ -470,6 +475,22 @@ public string DetermineType()
470475
return DetermineType(this.data, false);
471476
}
472477

478+
/// <summary>
479+
/// Retrieves a property name override for specific member names that require special handling
480+
/// during code generation to avoid naming conflicts or improve API consistency.
481+
/// </summary>
482+
/// <returns>
483+
/// A string containing the overridden property name if a special case applies,
484+
/// or null if the default property name should be used.
485+
/// </returns>
486+
private string GetPropertyNameOverride()
487+
{
488+
if (OwningShape.IsException && _name.ToUpperFirstCharacter() == "ErrorType")
489+
return "RequestErrorType";
490+
491+
return null;
492+
}
493+
473494
/// <summary>
474495
/// Determines the type of the member based on customizations, if it isn't custom then it pulls
475496
/// 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
@@ -133,14 +133,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
133133
/// </summary>
134134
public string RequestErrorType
135135
{
136-
get { return this._requestErrorType; }
137-
set { this._requestErrorType = value; }
136+
get { return this._errorType; }
137+
set { this._errorType = value; }
138138
}
139139

140140
// Check to see if RequestErrorType property is set
141141
internal bool IsSetRequestErrorType()
142142
{
143-
return !string.IsNullOrEmpty(this._requestErrorType);
143+
return !string.IsNullOrEmpty(this._errorType);
144144
}
145145

146146
}

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
@@ -135,14 +135,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
135135
/// </summary>
136136
public string RequestErrorType
137137
{
138-
get { return this._requestErrorType; }
139-
set { this._requestErrorType = value; }
138+
get { return this._errorType; }
139+
set { this._errorType = value; }
140140
}
141141

142142
// Check to see if RequestErrorType property is set
143143
internal bool IsSetRequestErrorType()
144144
{
145-
return !string.IsNullOrEmpty(this._requestErrorType);
145+
return !string.IsNullOrEmpty(this._errorType);
146146
}
147147

148148
}

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

@@ -135,14 +135,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
135135
/// </summary>
136136
public string RequestErrorType
137137
{
138-
get { return this._requestErrorType; }
139-
set { this._requestErrorType = value; }
138+
get { return this._errorType; }
139+
set { this._errorType = value; }
140140
}
141141

142142
// Check to see if RequestErrorType property is set
143143
internal bool IsSetRequestErrorType()
144144
{
145-
return !string.IsNullOrEmpty(this._requestErrorType);
145+
return !string.IsNullOrEmpty(this._errorType);
146146
}
147147

148148
/// <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
@@ -132,14 +132,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
132132
/// </summary>
133133
public string RequestErrorType
134134
{
135-
get { return this._requestErrorType; }
136-
set { this._requestErrorType = value; }
135+
get { return this._errorType; }
136+
set { this._errorType = value; }
137137
}
138138

139139
// Check to see if RequestErrorType property is set
140140
internal bool IsSetRequestErrorType()
141141
{
142-
return !string.IsNullOrEmpty(this._requestErrorType);
142+
return !string.IsNullOrEmpty(this._errorType);
143143
}
144144

145145
}

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

@@ -135,14 +135,14 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf
135135
/// </summary>
136136
public string RequestErrorType
137137
{
138-
get { return this._requestErrorType; }
139-
set { this._requestErrorType = value; }
138+
get { return this._errorType; }
139+
set { this._errorType = value; }
140140
}
141141

142142
// Check to see if RequestErrorType property is set
143143
internal bool IsSetRequestErrorType()
144144
{
145-
return !string.IsNullOrEmpty(this._requestErrorType);
145+
return !string.IsNullOrEmpty(this._errorType);
146146
}
147147

148148
/// <summary>

0 commit comments

Comments
 (0)