Refactor error handling and IHttpContextAccessor usage
Simplified error message construction in RoleApplication.cs by removing redundant properties. Refactored IHttpContextAccessor registration in Program.cs to use the service provider after app initialization. Removed redundant no-op code in NullFaceEmbeddingNotificationService.cs.
This commit is contained in:
@@ -27,4 +27,3 @@ public class NullFaceEmbeddingNotificationService : IFaceEmbeddingNotificationSe
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class RoleApplication : IRoleApplication
|
||||
{
|
||||
_unitOfWork.RollbackAccountContext();
|
||||
|
||||
return operation.Failed("ارتباط با اپلیکیش پروگرام منیجر برقرار نشد"+response.Result.errorMessage +response.Result.ErrorType + response.Error);
|
||||
return operation.Failed("ارتباط با اپلیکیش پروگرام منیجر برقرار نشد"+ response.Error);
|
||||
}
|
||||
|
||||
if (!response.Result.isSuccess)
|
||||
|
||||
@@ -331,15 +331,16 @@ builder.Services.AddParbad().ConfigureGateways(gateways =>
|
||||
storage.UseMemoryCache();
|
||||
});
|
||||
|
||||
#region GetHttpContext
|
||||
|
||||
var httpContextAccessor = new HttpContextAccessor();
|
||||
builder.Services.AddSingleton<IHttpContextAccessor>(httpContextAccessor);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
#region GetHttpContext
|
||||
|
||||
var httpContextAccessor = app.Services.GetRequiredService<IHttpContextAccessor>();
|
||||
|
||||
|
||||
#endregion
|
||||
app.UseCors("AllowSpecificOrigins");
|
||||
|
||||
#region InternalProgarmManagerApi
|
||||
|
||||
Reference in New Issue
Block a user