Open Closed

Localizing Exceptions in the domain layer #7103


User avatar
1
shreddersgr1 created
  • ABP Framework version: v8.1.1
  • UI Type: Blazor WASM
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): blazor
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello, We are in the process of implementing validation in the domain service layer. But we are **not **able to localize the exceptions correctly at that layer using IObjectValidator.ValidateAsync(entity)

Actually:

  • We receive localized exceptions if they are thrown from the application layer. Tags like [Required] and [StringLength] are correctly validated.
  • From the doc: Using data annotations is a simple way to implement the formal validation for a DTO in a declarative way
  • In our case, we want to use the same pattern for our entities
  • We tried to use the class ExceptionToErrorInfoConverter but it gave us a weird state where the message was translated but not the validation errors
What we wish is that the exception thrown by ABP using IObjectValidator.ValidateAsync() was localized for us.

Thanks a lot for your help.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    Could you share a small project to reproduce the problem? I will check it. thanks. shiwei.liang@volosoft.com

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 06, 2026, 12:23
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.