Activities of "berkansasmaz"

Hi,

We don't need to write a custom exception handling middleware for this, but instead we need to override ABP's DefaultExceptionToErrorInfoConverter.

Based on what I understand from your needs, I created a folder named ExceptionHandling in MyProjectName.Domain and put the following code in it.

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IExceptionToErrorInfoConverter))]
    public class MyExceptionToErrorInfoConverter : DefaultExceptionToErrorInfoConverter, IExceptionToErrorInfoConverter
    {
        public MyExceptionToErrorInfoConverter(IOptions<AbpExceptionLocalizationOptions> localizationOptions, IStringLocalizerFactory stringLocalizerFactory, IStringLocalizer<AbpExceptionHandlingResource> stringLocalizer, IServiceProvider serviceProvider) : base(localizationOptions, stringLocalizerFactory, stringLocalizer, serviceProvider)
        {
        }
        
        protected override RemoteServiceErrorInfo CreateErrorInfoWithoutCode(Exception exception, bool includeSensitiveDetails)
        {
            if (includeSensitiveDetails)
            {
                return CreateDetailedErrorInfoFromException(exception);
            }

            exception = TryToGetActualException(exception);

            if (exception is AbpRemoteCallException remoteCallException)
            {
                return remoteCallException.Error;
            }

            if (exception is AbpDbConcurrencyException)
            {
                return new RemoteServiceErrorInfo(L["AbpDbConcurrencyErrorMessage"]);
            }

            if (exception is EntityNotFoundException)
            {
                return CreateEntityNotFoundError(exception as EntityNotFoundException);
            }

            var errorInfo = new RemoteServiceErrorInfo();

            if (exception is IUserFriendlyException or ArgumentNullException) // Here ArgumentNullException
            {
                errorInfo.Message = exception.Message;
                errorInfo.Details = (exception as IHasErrorDetails)?.Details;
            }

            if (exception is IHasValidationErrors)
            {
                if (errorInfo.Message.IsNullOrEmpty())
                {
                    errorInfo.Message = L["ValidationErrorMessage"];
                }

                if (errorInfo.Details.IsNullOrEmpty())
                {
                    errorInfo.Details = GetValidationErrorNarrative(exception as IHasValidationErrors);
                }

                errorInfo.ValidationErrors = GetValidationErrorInfos(exception as IHasValidationErrors);
            }

            TryToLocalizeExceptionMessage(exception, errorInfo);

            if (errorInfo.Message.IsNullOrEmpty())
            {
                errorInfo.Message = L["InternalServerErrorMessage"];
            }

            errorInfo.Data = exception.Data;

            return errorInfo;
        }
    }

The only difference from the default CreateErrorInfoWithoutCode method is the line with the comment line.

Now you can see ArgumentException thrown in domain. Of course, you can customize how you want to see it according to your needs.

I hope my answer helps in customizing to your needs.

Hello, as a result of my tests, I encountered the same problem, it's a bug.

As a workaround, I copied the appsettings.json file inside the MyProjectName.Blazor project into the MyProjectName.Blazor/wwwroot folder.

I'm creating an internal issue related to the topic.

Hi, can't you download when you request via swagger?

Please give some more code details.

Hi 👋,

This question doesn't seem to be about ABP, but I still want to share with you a few tips we use in our own kitchen ✌️

For preview, you can convert the PDF file to JPG and show it to the user.

For printing we use the PdfSharpCore package. You can check this video about using the package. Basically what is done is to place the data according to the coordinates on PDF.

I hope this information will help you and you can do what you want more easily 😊

Unfortunately, I would really like to help on this issue, but I have no information. I don't think the problem is related to ABP

You are trying to view the log records from Azure, but maybe its configuration is missing.

If you think the problem is really related to ABP, you can send your application or minimal, reproducible example to berkan.sasmaz@volosoft.com

Hi,

As I understand it, our first problem has been solved. 👇👇

I am attempting to publish the application onto Azure. But sadly the services are not starting. Attached is the stdout.

Because the error in the first log record does not appear in the log anymore.

Coming to our current problem, I don't think it's related to ABP. There is no information about ABP in the last log you sent.

In this case, unfortunately I can't be of any further help 😔

Maybe you can consider lowering the log level of the application, then there may be information about ABP.

Is the log of the published application you run locally empty? If it is not empty, could you share the relevant log?

This is possible, if you delete the code in the picture in my previous answer from the MyProjectName.IdentityServer(and other projects) project, you can publish and run it with the Development environment variable.

But, I cannot recommend publishing the application in the Development environment because; In general,it is desirable that the Development and Production environment be as similar as possible. However, there are a few fundamental differences. For example, while the UseDeveloperExceptionPage middleware is requested to work only with the Development environment variable, the UseErrorPage middleware is requested to run in the Production environment. Considering such situations, even if what you want is not recommended, it does not mean that you cannot do it.

Can you share the relevant logs in MyProjectName.HttpApi.Host and MyProjectName.Web? And I would be very happy if you could share the details of the request sent over the network.

Hi,

You are probably not running the application in the Production environment.

Please make sure ASPNETCORE_ENVIRONMENT is Production!

The offending piece of code is the following code inside MyProjectNameIdentityServerModule under MyProjectName.IdentityServer project. This piece of code is set to run only in Developmentenvironment.

If you want, you can delete this piece of code and publish it again (on Azure or local machine) to make sure this is the problem. I think you will not get error this time.

If you don't get an error, you can fix the problem permanently by setting ASPNETCORE_ENVIRONMENT to Production where you run the application.

For more information you can check here.

Showing 281 to 290 of 331 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 05:21