#338 Error code parsing supports custom parsers. #339
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#338 Error code parsing supports custom parsers.
The original configuration method is as follows:
A new custom parser configuration parameter
valuesResolverClass
has been added, as follows:Smart-doc provides an interface
DictionaryValuesResolver
, as follows:The newly added
valuesResolverClass
parameter corresponds to a class that implements theDictionaryValuesResolver
interface. Its functionality in theEExceptionValuesResolver
class is as follows:Smart-doc extension. In the
com.power.doc.utils.DocUtil#errorCodeDictToList
method, add handling for thevaluesResolverClass
parameter. The original key code position is as follows:At the beginning, add an extension branch and modify it as follows:
Motivation(提出这个pr目的)
Company A has unified coding standards, and all exceptions (including error codes) inherit from an abstract base class (parent class)
EException
(neither an interface nor an enum).Basic common exception definition (inheriting
EException
)Microservice custom exception definition (inheriting
BaseEException
)Through subclasses, all definitions of
static
exceptions in the inheritance relationship can be referenced, and traditionally, the way enums implement interfaces independently and do not interoperate, preventing global maintenance across applications. This technique also enables the aggregation of all exceptions within a microservice through theBizEException
, facilitating global maintenance.